If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Does DB2 7.2.7 support NOT ENFORCED constraint?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-23-04, 09:02
hiolgc hiolgc is offline
Registered User
 
Join Date: Mar 2004
Posts: 61
Does DB2 7.2.7 support NOT ENFORCED constraint?

Hi there,

CREATE TABLE class_list
(studentId INTEGER,
grade INTEGER CONSTRAINT grade12 CHECK (grade <= 100) NOT ENFORCED)

Error:
08:57:47.877 DBMS SAMPLE -- Error: [IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token "ENFORCED" was found following "K (grade <= 100) NOT". Expected tokens may include: "REFERENCES". SQLSTATE=42601

And,

ENFORCED or NOT ENFORCED
Specifies whether the constraint is enforced by the database manager during normal operations such as insert, update, or delete. The default is ENFORCED.
ENFORCED
The constraint is enforced by the database manager. 7 ENFORCED cannot be specified for a functional 7 dependency (SQLSTATE 42621). 7 ENFORCED cannot be specified when a referential 7 constraint refers to a nickname (SQLSTATE 428G7).
NOT ENFORCED
The constraint is not enforced by the database manager. This should only be specified if the table data is independently known to conform to the constraint.

What's that meaned to the "NOT ENFORCED"?

and the following contents of the CLASS_LIST table:


STUDENTID GRADE
----------------- -----------
98 100

123 123

101 98


How many records will be retrieved by the following statement? SELECT * FROM class_list WHERE grade = 123?

If the row can be inserted into table, why it can not be retrived?

Merry Christmas to every body,

Last edited by hiolgc; 12-23-04 at 09:07.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On