Thursday, August 6, 2015

Update incremental value in one colum with one update statement in SQL

Declare @CorporateId int = 12, @SortOrder int
Set @SortOrder = 0
Update DashboardIndicators SET @SortOrder = SortOrder = @SortOrder + 1 Where CorporateId = @CorporateId

No comments:

Post a Comment