Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rbaldwin
Starting Member
4 Posts |
Posted - 2006-08-16 : 09:16:39
|
i'm just creating a table, no data as yet.i have a varchar(15) fld with Nulls NOT allowedi want to create a constraint that this field named ipkey be UNIQUE.I'm having trouble with the syntax for the constraint expression.i've typed in the SQL Server Managment Studio Express Expression field: UNIQUE(ipkey)and@unq_ipkey UNIQUE(ipkey)SQL Server Managment Studio Express complains:"Error validating constrating, do you want to edit expression"So - what am i doing wrong?And thanks for taking the time to help. |
|
KenW
Constraint Violating Yak Guru
391 Posts |
Posted - 2006-08-16 : 14:56:57
|
rbaldwin,Just use the unique constraint when you create the column:CREATE TABLE WhatEver( ipKey VarChar(15) NOT NULL UNIQUE)Ken |
|
|
rbaldwin
Starting Member
4 Posts |
Posted - 2006-08-16 : 15:00:58
|
Ooops sorry my confusion.for Unique index IS the way to go. Thanks for pointing me in the right direction. |
|
|
|
|
|