dbTalk Databases Forums  

Adding unique constraint

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss Adding unique constraint in the sybase.public.sqlanywhere.general forum.



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

Default Adding unique constraint - 12-22-2009 , 01:34 PM






Hi all...
Getting back into SQL Anywhere after being away awhile, so please forgive
the newbie-ish question.
I'm wanting to add a unique contraint to a column...
I've found examples using "CREATE TABLE" syntax, but for some reason, I'm
having trouble finding syntax for adding column uniqueness using "ALTER
TABLE syntax.
Any ideas?

Thanks...


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4710 (20091222) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Reply With Quote
  #2  
Old   
Kory Hodgson (Sybase iAnywhere)
 
Posts: n/a

Default Re: Adding unique constraint - 12-22-2009 , 01:58 PM






This should add a unique constraint to a column:

ALTER TABLE table_name ADD UNIQUE (column_name);


SQL Antwhere wrote:
Quote:
Hi all...
Getting back into SQL Anywhere after being away awhile, so please
forgive the newbie-ish question.
I'm wanting to add a unique contraint to a column...
I've found examples using "CREATE TABLE" syntax, but for some reason,
I'm having trouble finding syntax for adding column uniqueness using
"ALTER TABLE syntax.
Any ideas?

Thanks...

__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4710 (20091222) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



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

Default Re: Adding unique constraint - 12-22-2009 , 03:30 PM



thx Kory ... column in question had to be set for "no nulls" first ( of
course ) but your syntax worked great ...I appreciate the help.

"Kory Hodgson (Sybase iAnywhere)" <khodgson (AT) A_SPAM_FREE_sybase (DOT) com> wrote in
message news:4b3124e3$1 (AT) forums-1-dub (DOT) ..
Quote:
This should add a unique constraint to a column:

ALTER TABLE table_name ADD UNIQUE (column_name);


SQL Antwhere wrote:
Hi all...
Getting back into SQL Anywhere after being away awhile, so please forgive
the newbie-ish question.
I'm wanting to add a unique contraint to a column...
I've found examples using "CREATE TABLE" syntax, but for some reason, I'm
having trouble finding syntax for adding column uniqueness using "ALTER
TABLE syntax.
Any ideas?

Thanks...

__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4710 (20091222) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4710 (20091222) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




__________ Information from ESET NOD32 Antivirus, version of virus signature database 4710 (20091222) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

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 - 2012, Jelsoft Enterprises Ltd.