Results 1 to 2 of 2

Thread: Modifying a column

  1. #1
    Mike Guest

    Modifying a column


    I have an existing table called OrderHeader with a column called ID. The ID column is currently set as an INT. I want to run a script to modify that column to be an IDENTIY. I've tried the following:

    ALTER TABLE OrderHeader ALTER COLUMN [ID] INT IDENTITY

    but this does not work.

    Any idea how to accomplish this?

    Thanks!

    Mike


  2. #2
    Todd Guest

    Modifying a column (reply)

    You have to recreate the table. Follow these steps.

    Create New table with appropriate defintions
    Insert Records from old table
    drop old table (truncate first for performance boost)
    Rename New table using sp_rename
    Create Indexes and constraints on New table.

    The easy way to get this script is to Go into EM. Desgin Table. Click the identity box for the column then use the scripting feature.



    ------------
    Mike at 1/10/2002 1:33:47 PM


    I have an existing table called OrderHeader with a column called ID. The ID column is currently set as an INT. I want to run a script to modify that column to be an IDENTIY. I've tried the following:

    ALTER TABLE OrderHeader ALTER COLUMN [ID] INT IDENTITY

    but this does not work.

    Any idea how to accomplish this?

    Thanks!

    Mike


Posting Permissions

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