Reputation: 53921
I know this is very simple, but how do I do this in plain SQL?
Upvotes: 0
Views: 434
Reputation: 15179
Are you talking about check constraints?
alter table MyTable add constraint CC_Dates check (FromDate < ToDate)
Upvotes: 0
Reputation: 839224
For a unique constraint during table creation:
CREATE TABLE T1 (
Col1 int NOT NULL,
Col2 int NOT NULL,
UNIQUE (Col1, Col2)
)
After table creation:
ALTER TABLE T1 ADD UNIQUE (Col1, Col2)
Upvotes: 3