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 |
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2007-03-05 : 06:29:59
|
| in sql management express how do i indicate a field that does not allow duplicates? |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-05 : 06:51:26
|
| Make field non-null and add UNIQUE constraint on the field.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2007-03-05 : 07:01:29
|
| how do i do this in management express? |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2007-03-08 : 02:11:28
|
| can you tell me the syntax to do this -- to change the field to have a unique constraint |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-08 : 02:18:37
|
| [code]-- to make field Non-Nullablealter table <table-name>alter column <column-name> <data-type> not nullGO-- to add unique constraintalter table <table-name>add constraint <constraint-name> unique(<column-name>)GO[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2007-03-08 : 02:25:50
|
| what should be the constraint name or does it not matter? |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-08 : 02:30:20
|
| You can give any descriptive name or it may depend upon your company's naming standards.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|