Updating a pre-existing Microsoft SQL table to have an identity column without losing data

Updating a pre-existing Microsoft SQL table to have an identity column without losing data

Problems and Solutions, SQL
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... How to proceed? The following is my regular workaround to the problem. (more…)
Read More