Decrease Font Size
Increase Font Size
   BLOG

How to change a IDENTITY column to NON-IDENTITY and vice versa

At one point we might come across situations where we have to disable the identity property from an existing column of a table for certain transaction. For instance, if we want to sync two tables from a different databases or server.

--drop identity
ALTER TABLE MyTable
DROP COLUMN myColumnName
GO
ALTER TABLE MyTable
ADD myColumnName int NULL
GO

--restore identity
ALTER TABLE MyTable
DROP COLUMN myColumnName
GO
ALTER TABLE MyTable
ADD myColumnName INT IDENTITY(1,1) NOT NULL

Comments (2) -

  • Doors UK

    2/10/2010 10:58:59 AM |

    It is really impressive to share these useful contents and moreover if U wanna looking for best home utilities try out our EG-Doors of U.K limited for comfort and safety attachments...

  • Cho Yung Tea

    5/3/2010 9:56:18 AM |

    Advantageously, the post is actually the greatest on this precious topic. I fit in with your conclusions and will thirstily look forward to your incoming updates. Saying thanks will not just be adequate, for the phenomenal clarity in your writing. I will instantly grab your rss feed to stay informed of any updates. Fabulous work and much success in your business efforts!

Add comment

Loading