Insert into an auto increment column

  • I have a simple table named Manu with columns: ManuID and ManuName. ManuID is auto incrementing staring from 1. This table is on my laptop in SQLServer 2005 Express and has about 50 records. I would like to create the same table in our production SQL2000 server with identical data.

    The plan was to create a flat file from the query output SELECT * FROM Manu. Then USE DTS to load all the values into the SQL2000 table called Manu.

    Is there a way to force the insertion of the ManuID values from the flat file into the ManuID column in SQL2000?

    Thanks

    CSC

  • Yes,

    Use SET INSERT_IDENTITY manu ON

    You have to specify the column names on your insert statement.

    Use SET INSERT_IDENTITY manu ON

    Insert into manu (col1, col2)

    Values (1, 999)

  • OOPS 🙂

    Sorry wrong syntax

    SET IDENTITY_INSERT manu ON

  • Awesome.

    I'll give it a try.

    Thanks

    CSC

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply