Creating a SQL CLR User-Defined Type

Thanks to the SQL CLR, you can write .NET code to store your own custom data types in a SQL Server 2005 database.

Not all data can be represented in data types that SQL Server natively supports. Perhaps you want to store a date/time value that includes a time zone. Maybe you want a column in a table to contain values that represent a point in three-dimensional space or a location based on very precise GPS coordinates. If you can describe the structure of your type using .NET code, you can store data in a SQL Server 2005 database using that code.

This portion of the chapter will construct a user-defined SQL CLR type that contains the line items for an order and store that data in a column in the Orders table. ...

Get Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.