Lately I was thinking why Microsoft didn’t implement ANSI standard Create Domain command instead of CLR User-Defined Data Types (UDDTs). After all, I realized I like the idea of implementing them in :NET languages. Why?

                Well, I recognized for implementing a data type you need to implement many fine-grain methods. Non-procedural languages, like T-SQL, consist of larger building blocks, of commands. Think of it – a UDDT knows to do only things you define in its methods and properties, which are actually methods as well). Now imagine how many different methods you have to implement just for basic operations even for a very simple type! Also, your mutator methods should be resilient on input errors; therefore you need to perform some control and constraints on the input. Regular expressions, for example, are very useful for this task. Programming all these fine details would be very clumsy in a non-procedural language.

                So my conclusion is MS implemented UDDTs in a correct way. My only disappointment is MS did not decide to include operator overloading in UDDTs, but this is another story.

Dejan Sarka