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 > Information Constraint

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-08-04, 06:36
ksolomon ksolomon is offline
Registered User
 
Join Date: Jun 2004
Posts: 38
Unhappy Information Constraint

Hello,

I've created a table which implements Informational constraint as follows

create table tab1(SNum integer, Name char(30), constraint c1 check (Num > 10) no enforced enable query optimization)

(Not sure whether this implements informational constraint)

After inserting the following records
1, Abdul
2, Babu
3, Chand
11, Ravi
12, Ram

I feel that select statement on tab1 would return me the last 2 records, (11 Ravi and 12 Ram) as per the informational constraint. But I'm getting all the inserted records in the output.

Can any one help me on this?
Reply With Quote
  #2 (permalink)  
Old 10-08-04, 08:21
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Informational constraints are strictly to help the optimizer to understand the type of contents and values of the column and get better optimized queries

Otherwise, for your application/SQL resultset, informational constrains do not mean anything serious ..

HTH

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 10-08-04, 08:59
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
You can implement what you want through a view:

create view myview as select * from tab1 where num > 10

Then when you run you query, do it against the view:

select * from myview

should get you the results you want.

HTH

Andy
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