Updating identity column

Updating identity column

* according to this, couchbase 2.2.0 starting 20th of June*The underlying problem is that My SQL accepts identity updates (when there are no changes) but Sql Server being properly designed complains with this bad practice. But there might be times when you would want to change the value of an identity column. I have not come across a way by which you can update the identity column but there sure is a way to insert one.SQL Server parse and compile time: CPU time = 0 ms, elapsed time = 17 ms. Scan count 1, logical reads 23751, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

We will take a look at this approach as well as looking at how to do this with a simple UPDATE statement.

This can be seen here (SET @id = id = @id 1) where we are making the @id value and the id column equal to the current @id value 1.

SQL Server parse and compile time: CPU time = 0 ms, elapsed time = 247 ms.

You’ve created a Microsoft SQL Server table, added some data and then realised that integer column you created would be much better off as an identity column.

You go to alter the table but SQL Server won’t allow you to change your integer column into an identity one without re-creating the table and losing the data… The following is my regular workaround to the problem.

updating identity column-49updating identity column-54updating identity column-24

Join our conversation (36 Comments).
Click Here To Leave Your Comment Updating identity column.


Leave a Reply

Your email address will not be published. Required fields are marked *