dbTalk Databases Forums  

check unique

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss check unique in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Yaro
 
Posts: n/a

Default check unique - 04-13-2005 , 08:55 AM






Hello

What is correct syntax to do declare unique constraint on two fields in
table (UDB 8.2, Win)?

Statement:

CREATE TABLE mytest(
p1 INTEGER NOT NULL,
p2 INTEGER NOT NULL,
CONSTRAINT myunique CHECK(UNIQUE(p1,p2))
)@

give me an error:

SQL0104N Unexpected element founded ")" after text "CHECK( unique(p1,p2)".
Acceptable elements are: "<interval_qualifier> ".

I know, I can declare unique index on this fields, but....how do this with
UNIQUE?

Thanks
Yaro



Reply With Quote
  #2  
Old   
Art S. Kagel
 
Posts: n/a

Default Re: check unique - 04-13-2005 , 09:43 AM






Yaro wrote:
Quote:
Hello

What is correct syntax to do declare unique constraint on two fields in
table (UDB 8.2, Win)?
CREATE TABLE mytest(
p1 INTEGER NOT NULL,
p2 INTEGER NOT NULL,
CONSTRAINT myunique UNIQUE(p1,p2)
)@

Art S. Kagel


Quote:
Statement:

CREATE TABLE mytest(
p1 INTEGER NOT NULL,
p2 INTEGER NOT NULL,
CONSTRAINT myunique CHECK(UNIQUE(p1,p2))
)@

give me an error:

SQL0104N Unexpected element founded ")" after text "CHECK( unique(p1,p2)".
Acceptable elements are: "<interval_qualifier> ".

I know, I can declare unique index on this fields, but....how do this with
UNIQUE?

Thanks
Yaro



Reply With Quote
  #3  
Old   
Yaro
 
Posts: n/a

Default Re: check unique - 04-14-2005 , 01:28 AM



Really simple. Works.
Thank you

Yaro



Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.