MSSQLServer

Identity Column – Moving data

In MS SQL Server, I was copying data from one database to another and wanted to preserve the values in the identity column. I had to put these statements around my sql.

SET IDENTITY_INSERT tablename ON
go

go

SET IDENTITY_INSERT tablename OFF
go

Advertisements