Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / July 2008

Tip: Looking for answers? Try searching our database.

alter table alter column to set column constraint unique

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mr Major Thorburn - 08 Jul 2008 13:20 GMT
I feel sure its a simple question but can someone give me the correct syntax
to alter a column to enable a unique constraint.

I thought the following would work
alter table tabname alter column colname add constraint constname unique

Please help if you can.

Regards, Major.
p.s. Major is my Christian name ;-)
Dan Guzman - 08 Jul 2008 13:21 GMT
Signature

Hope this helps.

Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/

>I feel sure its a simple question but can someone give me the correct
>syntax
[quoted text clipped - 7 lines]
> Regards, Major.
> p.s. Major is my Christian name ;-)
Dan Guzman - 08 Jul 2008 13:25 GMT
> I thought the following would work
> alter table tabname alter column colname add constraint constname unique

Try:

ALTER TABLE SchemaName.TableName
ADD CONSTRAINT ConstraintName
UNIQUE (ColumnName)

Signature

Hope this helps.

Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/

>I feel sure its a simple question but can someone give me the correct
>syntax
[quoted text clipped - 7 lines]
> Regards, Major.
> p.s. Major is my Christian name ;-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.