Sunday, February 17, 2019

How to update identity Column table without changing Identity


 Create replicate table Using script out

Then Insert all data to new create column
Insert INTO [dbo].[TestBRZ] SELECT *  FROm [dbo].[Subaru_BRZ]
Then get the script update table A using Script out
After that insert data to table A  using Proper column
SET IDENTITY_INSERT [dbo].[Subaru_BRZ] ON

INSERT INTO  [dbo].[Subaru_BRZ] (carID,milage)
SELECT carID,milage
From [dbo].[TestBRZ]
SET IDENTITY_INSERT [dbo].[Subaru_BRZ] OFF

UPDATE [dbo].[Subaru_BRZ]
SET color  = 'B'
WHERE carID = 3
Done!

No comments:

Post a Comment

How to Login Azure SQL database using SSMS

How to Login Azure SQL database using SSMS You`ll be able to login Azure SQL database using your local SSMS. There are simple steps you n...