Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Posts
    266

    Unanswered: UNIQUE but not PRIMARY

    Hello
    for MS SQL 2000 I want to CREATE a Table as follow :

    CREATE TABLE [dbo].[Local] (
    [id_Local] [int] IDENTITY(1,1) NOT NULL,
    [Name] [nvarchar] (100) NOT NULL,
    [Info] [nvarchar] (100) NULL
    )


    id_Local is PrimaryKey autoincrement
    but Name must be UNIQUE (not 2 times the same name)

    how can script it ?

    thank you

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    CREATE TABLE [dbo].[Local] (
    [id_Local] [int] IDENTITY(1,1) NOT NULL,
    [Name] [nvarchar] (100) NOT NULL UNIQUE,
    [Info] [nvarchar] (100) NULL
    )
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Dec 2005
    Posts
    266
    it works
    thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •