Solved

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

Posted on 2007-11-21
6
2,155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 25

Expert Comment

by:imitchie
ID: 20326407
do you mean just create unique constraint?
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20326415
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
ID: 20326423
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
ID: 22168142
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

632 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