To increment a column value in sql table with simple update statement is shown below.
DECLARE @incrementer bigint
SET @incrementer = 0
update
tablename
set @incrementer = columnname= @incrementer + 1
This can be achieved even with cursors but we all know the disadvantages of cursors in sql.
This query works even, if column is NULL.
This My first information in MyBlog - Krafting DotNet.
DECLARE @incrementer bigint
SET @incrementer = 0
update
tablename
set @incrementer = columnname= @incrementer + 1
This can be achieved even with cursors but we all know the disadvantages of cursors in sql.
This query works even, if column is NULL.
This My first information in MyBlog - Krafting DotNet.
No comments:
Post a Comment