Editorials

User Defined Types

Webcast: SQL Server and SharePoint Data Integration
SharePoint’s Data View web part can do much more than just view data. It can serve as a complete front-end to your SQL Server (and other data store) information allowing you to create robust applications without writing code. In this session, you will see just how to create such an application including conditional graphics. You’ll even learn how to pass data from SQL Server into a SharePoint Designer workflow for business process automation.
Presented by: Ricky Spears

> Register Now
> Live date: 10/6/2010 at 12:00 Pacific

New SelecTViews Show Posted
Check out the new studio!! Take a look at our new digs – more to come on this… interviews today include Eric Johnson and Jeff Garbus – lots of great information on SSIS, SQL Server and much more.
[Watch the show here]

User Defined Types
In SQL Server there are many uses for User Defined Types (UDT). Often they can be used to enforce consistent naming of data types as well as other things.

With SQL Server 2008, you can define complex user defined data types such as tables. A user defined table data type can be used to pass data into stored procedures as a parameter from external clients or from other stored procedures.

One thing I have been thinking about is the use of a CLR UDT. With a CLR UDT you have more options. You can use any data type found in .Net, even if it is not a native SQL type. Also, your new type can have methods or properties associated with it.

So, I was working with a friend on a project he is doing in MySQL. MySQL has a data type called an ENUM. With this data type you can specify options that are available to any instance of this data type. It automatically converts from the ENUM text to the appropriate internal storage. I’m thinking this could be done with a well defined SQL Server CLR UDT.

The type would have methods for enumeration. It would be able to enforce valid constraints. You could build in conversion techniques into other data types. Who knows?

So, do you play with User Defined Types? Drop a note and share what you have done. Send your comments to btaylor@sswug.org.

Cheers,

Ben

Featured Article(s)
Elemental MDX: Additional “Family” Members Functions, Part 2
Part 2: BI Architect Bill Pearson continues his Elemental MDX Series with an introduction to more member “family” functions. In this lesson, we will continue our exploration with the .FirstChild, .LastChild, .FirstSibling and .LastSibling functions, and then conclude the “family” functions group of articles with an examination of the Cousin () function.

Featured Script
sp__noprimarykeys.sql
Returns list of tables that have no primary key… (read more)

Featured White Paper(s)
VIDEO WHITEPAPER – How to Avoid Downtime – VIDEO WHITEPAPER
In this Experts & Insights video, we take a close-up look at the data protection challenges and solutions surrounding downtim… (read more)