Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

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

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

srouse
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.

Thanks

Scott

dportas
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  
 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.04 seconds. Powered By: Snitz Forums 2000