SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Non-future dates, constraint on type
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

7 Posts

Posted - 02/12/2010 :  11:22:18  Show Profile  Reply with Quote
I need a domain that will not allow future dates. i.e. <= getdate()
I've previously accomplished this with a rule, but since Microsoft is deprecating rules and recommending check constraints I need to change my ways.

Is it possible to put a check constraint on a user defined type?

I know I can add column constraints per table, but I would rather apply it to the datatype if possible.



Yak Posting Veteran

United Kingdom
53 Posts

Posted - 02/12/2010 :  17:15:05  Show Profile  Reply with Quote
SQL User Defined Types are obsolete and deprecated. You could use a CLR UDT but I don't see much point just to add a <=GETDATE() constraint. My suggestion would be to use CHECK constraints on your columns. Or why not validate the value in a stored procedure.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000