Как скопировать строку со всеми столбцами, кроме столбца идентификаторов (SQL Server 2005)

Мой код:

SELECT * INTO #t FROM CTABLE WHERE CID = @cid   --get data, put into a temp table


ALTER TABLE #t
DROP COLUMN CID       -- remove primary key column CID


INSERT INTO CTABLE SELECT * FROM #t   -- insert record to table
DROP TABLE #t                                -- drop temp table

Ошибка:

Msg 8101,
An explicit value for the identity column in table 'CTABLE' can only 
be specified when a column list is used and IDENTITY_INSERT is ON.

И я установил

SET IDENTITY_INSERT CTABLE OFF
GO
9
задан Seth 5 August 2011 в 17:34
поделиться