Replacement for deprecated SQL Server User Defined Type with a bound Rule and Default

Posted by Adam Jones on Stack Overflow See other posts from Stack Overflow or by Adam Jones
Published on 2011-02-06T01:02:19Z Indexed on 2011/02/06 15:25 UTC
Read the original article Hit count: 297

We have a User Defined Data Type of YesNo which has an which is an alias for char(1). The type has a bound Rule (must be Y or N) and a Default (N).

The aim of this is that when any of the development team create a new field of type YesNo the rule and default are automatically bound to the new column.

Rules and Defaults have been deprecated and won't be available in the next a future version of SQL Server, is there another way to achieve the same functionality?

I should add that I'm aware that I could use CHECK and DEFAULT constraints to replicate the functionality of the bound Rule and Defalut objects, however these would have to be applied at each usage of the type, rather than getting the functionality 'for free' by using a UDT which has a bound Rule and Default.

The post relates to a database that backs an existing application, rather than a new development, so I'm aware that our use of UDT's is less than optimal.

I suspect the answer to the question is 'No', however normally when features are deprecated there's usually an alternative syntax that can be used as a drop in replacement so I wanted to pose the question in-case someone knew of an alternative.

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server