-
There are 2 ways for making constraint referencing another column.
1. Making constraint in table level :
CREATE TABLE Session (
session_key char(18) NOT NULL,
course_key char(18) NOT NULL,
site_key char(18) NOT NULL,
instructor_key char(18) NOT NULL,
start_date smalldatetime NULL,
end_date smalldatetime NULL,
CONSTRAINT date_ck CHECK (end_date >= start_date)
)
2. After creating table "Session"
alter table Session
add constraint date_chk CHECK (end_date >= start_date)
Funny with good day
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|