How to update a column value with Autoincrement value in SQL server
As a full stack developer many time we face we accidently create a column with some value or we want to add column in table and provide the value in it with auto increment to we can do it with following query
DECLARE @counter int
SET @counter = 0
UPDATE Your_Table_Name
SET @counter = your_table_column_name = @counter + 1
Example:
DECLARE @counter int
SET @counter = 0
UPDATE [Policy].[MasterBroker]
SET @counter = brokerId = @counter + 1
As a full stack developer many time we face we accidently create a column with some value or we want to add column in table and provide the value in it with auto increment to we can do it with following query
DECLARE @counter int
SET @counter = 0
UPDATE Your_Table_Name
SET @counter = your_table_column_name = @counter + 1
Example:
DECLARE @counter int
SET @counter = 0
UPDATE [Policy].[MasterBroker]
SET @counter = brokerId = @counter + 1
No comments:
Post a Comment