In this post we’ll explore using SQLCLR integration to provide validation of South African Identity numbers – with the focus being slightly more on the ins and outs of CLR integration, than on how RSA ID numbers get validated. If you’re after the validation algorithm, look here . So what’s on the slab?... This solution makes RSA ID number validation possible by exposing a C# table valued function (TVF) to SQL server. The function takes an identity number as its input, and returns a single record with the following columns: IsValid - bit: Whether the input identity number is valid. IsCitizen - bit: Whether the number belongs to a South African citizen. Gender - char: The gender of the individual - ‘M’ for male, ‘F’ for female. DateOfBirth - date: The date of birth of the individual. Why a table valued function? Glad you asked. (...just smile politely, nod and pretend you did!) Given the 4 output fields above, it is tempting to