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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 constraint

Author  Topic 

sfalalu
Starting Member

7 Posts

Posted - 2014-06-27 : 04:16:40
Hello every one i want to know how to make StartDate and EndDate should be greater than current date

Niit

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2014-06-27 : 14:07:06
As a sample:
ALTER TABLE <Table Name> ADD CONSTRAINT <Constraint Name> CHECK (StartDate > SYSDATETIME())
Go to Top of Page

sfalalu
Starting Member

7 Posts

Posted - 2014-06-27 : 15:51:40
Thanks but what i mean is that the "StartDate " is a column from another table

Thanks
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-06-27 : 16:01:44
quote:
Originally posted by sfalalu

Thanks but what i mean is that the "StartDate " is a column from another table

Thanks


If startdate is from another table, then where do you want to make startdate greater than current date? Is there yet another table that has a startdate column?
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2014-06-27 : 16:16:20
No clue what you want then. Here are some links that describe how to ask your question(s) so we can help you better:

http://www.sqlservercentral.com/articles/Best+Practices/61537/
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -