Solved

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

Posted on 2007-11-21
6
2,145 Views
Last Modified: 2008-11-11
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
Comment
Question by:Marius0188
  • 3
6 Comments
 
LVL 25

Expert Comment

by:imitchie
Comment Utility
do you mean just create unique constraint?
0
 
LVL 25

Expert Comment

by:imitchie
Comment Utility
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
 
LVL 25

Accepted Solution

by:
imitchie earned 500 total points
Comment Utility
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
 

Author Comment

by:Marius0188
Comment Utility
Can you provide the steps in the Studio Management Tool?
For example:
Select "Contstraints", right click and select "New Constraint".... etc.

Thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now