Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unique Fields

Status
Not open for further replies.

kim1

Programmer
Nov 7, 2001
77
CA
Hi Guys,

I want to do this

TableA (ColA, ColB, ColC, ColD)

Primary key: ColA, ColB

I want (ColC + ColD) a unique value

Do I have to create an index on ColC+ColD as Unique value in order to have a unique value for those 2 fields which are not part of the primary key?

Thank you very much for your help.
Kim
 
If you put a Unique Constraint on a table SQL Server will automatically creates a UNIQUE index to enforce the uniqueness requirement.

On my tables I always put on Unique Constraints as indexes and make that index unique. My naming conventions tell me how my different indexes operate.

Rick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top