First delete all the records of the data table where you need to insert new records. Then add following two rows(in bold) at the beginning and end of your data insert script as follows an run the script.
set IDENTITY_INSERT TableName ON
INSERT INTO [DatabaseName].[dbo].[TableName]([IndentityColumn],[Column2], [Column3])
values(1,'test','test')
INSERT INTO [DatabaseName].[dbo].[TableName]([IndentityColumn],[Column2], [Column3])
values(2,'test2','test2')
INSERT INTO [DatabaseName].[dbo].[TableName]([IndentityColumn],[Column2], [Column3])
values(3,'test3','test3')
set IDENTITY_INSERT TableName OFF
0 comments:
Post a Comment