Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2161
  • Last Modified:

MS SQL 2005 Express :: Give non key field UNIQUE constraint?

Hi Experts,

Please give me all the necessary steps in order to set a non-key field to unique constraint.
Note that I am using the "SQL Server Management Studio Express".

Thanks in advance!
0
Marius0188
Asked:
Marius0188
  • 3
1 Solution
 
imitchieCommented:
do you mean just create unique constraint?
0
 
imitchieCommented:
if you have   create table tbl ( f1 int, f2 char(1), f3 bit, f4 datetime )
and you want to make sure that f4 (the datetime) is unique, you'd add a constraint using

alter table tbl add constraint uq_f4 unique(f4)
0
 
imitchieCommented:
so the steps:
in object explorer, find the database you want to work on. right-click, new query
type the SQL statement
press F5 to run the statement
0
 
Marius0188Author Commented:
Can you provide the steps in the Studio Management Tool?
For example:
Select "Contstraints", right click and select "New Constraint".... etc.

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now