[Solved] SQL – Temptable Identity Column not working [duplicate]


You have defined three columns in the INSERT INTO statement – but the SELECT only provides two.

Change your code to so you’re not inserting values into your IDENTITY column:

-- NOT NEEDED! SET IDENTITY_INSERT #TEMPTABLE ON;

INSERT INTO #TEMPTABLE(CARDNO, OFFICEPUNCH) 
    SELECT CARDNO, OFFICEPUNCH 
    FROM [Tempdata]

-- NOT NEEDED! SET IDENTITY_INSERT #TEMPTABLE OFF;

1

solved SQL – Temptable Identity Column not working [duplicate]