Avoid Duplication

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Adithya Adi
    New Member
    • Oct 2011
    • 12

    Avoid Duplication

    I am a Beginner of SQL Server. 'm using SQL Server Management Studio.

    I'd like to know how can I avoid duplication in a Column other than Primary key. B'cuz I used a primary key in another column.

    eg.
    ID Name Age ---> Columns
    -- ---- ---

    1. ID is Primary Key,
    2. I don't want to enter the same name again,
    3. Age doesn't matter, whatever it is.

    So could anyone help me out with this ??
  • Sivaranjani
    New Member
    • Dec 2011
    • 16

    #2
    Use Unique key for the Name

    create table sample1 (column1 bigint primary key,column2 varchar(100) unique)

    Comment

    Working...