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 ;-)