Identity Insert

  • hopefully a quick one

    This tsql

    SET IDENTITY_INSERT dbo.tblSCVMatchedv3 ON

    insert into dbo.tblSCVMatchedv3 select * from tblSCVMatchedv3_Base

    is getting this error

    An explicit value for the identity column in table 'dbo.tblSCVMatchedv3' can only be specified when a column list is used and IDENTITY_INSERT is ON.

    where am i going wrong?

     

  • When inserting a specific value into an identity column, you need to specify the columns in your table that you want to put values into, including the identity column.

    eg:

    create table #test (id int identity, val int)

    set identity_insert #test on
    insert into #test (id,val) values (100, 200)

    both the id and val columns are specified

    You will need to specify the relevant columns that are in your tblSCVMatchedv3 table

     

     

  • Excellent Thanks

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

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