Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Location
    Pinoy in NJ
    Posts
    104

    Question Unanswered: Alter table with PRIMARY KEY

    I have an existing table (with records) having the ff: structure:

    Code:
    CREATE TABLE [dbo].[TEMP2_WORKORDER] (
    	[WorkOrderID] [int] IDENTITY (1, 1) NOT NULL ,
    	[JobType] [varchar] (3) NULL ,
    	[JobID] [varchar] (10) NULL ,
    I want to be modify the structure to add a PRIMARY KEY to the [WorkOrderID] column.

    I was using ALTER TABLE but can't get the right syntax. Please help!

    Thanks

  2. #2
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621

    Re: Alter table with PRIMARY KEY

    ALTER TABLE dbo.TEMP2_WORKORDER ADD CONSTRAINT
    PK_testtable PRIMARY KEY CLUSTERED
    (
    WorkOrderID
    )

  3. #3
    Join Date
    May 2003
    Location
    Pinoy in NJ
    Posts
    104

    Thumbs up

    Thank you. It did the trick!

Posting Permissions

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