How to update column value with auto increment number or unique number

Kapildalke
Posted by Kapildalke under Sql Server category on | Points: 40 | Views : 1739
Using this query we can update any column value with any unique number with n number of digit.
==================================================

DECLARE @counter varchar(max)
SET @counter = 1000000000
UPDATE TableName
SET @counter = ColumnName = @counter + 1

Using this query you can update with string character to any of the column value
==================================================

Put table name , column name and give a identity column value.

UPDATE TableName
SET ColumnName = 'Test_User_' + convert(varchar,IdentityColumnName)
SELECT * FROM TableName

Comments or Responses

Login to post response