Anand B
Anand B

Reputation: 66

Migration of data

I want to migrate the data from one table to another. Here Table1 has identity column. I require Table2 to have same data and identity.

How can I do this?

Upvotes: 1

Views: 172

Answers (1)

Jim B
Jim B

Reputation: 8574

Admittedly, this is very basic, but would this work?

SET IDENTITY INSERT dbo.Table2 ON

INSERT INTO dbo.Table2
SELECT ...
FROM dbo.Table1

SET IDENTITY INSERT dbo.Table2 OFF

Upvotes: 1

Related Questions