Basically I need to run this query in SQL Server. I executed in MySQL and it works fine.
SET @startID:=29;
update test
set ID=@startID:=@startID+1;
Thanks
Basically I need to run this query in SQL Server. I executed in MySQL and it works fine.
SET @startID:=29;
update test
set ID=@startID:=@startID+1;
Thanks
try this format
declare @startid int;
set @startid = 29;
update test set ID = @startid+1;
You can do it as followed:
SET @startID = 29
update test
set user_id = @startID, @startID=@startID+1
It will increment the @startID variable everytime it updates.