[posted and mailed, please reply in news]
Dhruv (dm**********@yahoo.com) writes:
I was wondering how to do this.
I have a table with two columns in design view (start date, end date).
How do I set it within sql server (as constraint) or whatever that the
start date less than or equal to end date?
CREATE TABLE hoppla (a int NOT NULL,
startdate datetime NOT NULL,
enddate datetime NULL,
CONSTRAINT pk_hoppla PRIMARY KEY (a),
CONSTRAINT ckt_dates CHECK (startdate <= endddate))
Note: this is a command to run in Query Analyzer. I guess that with
"design view" you mean something in Enterprise Manager, but I don't
use that, so I don't know you add a constraint this way.
--
Erland Sommarskog, SQL Server MVP,
es****@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp