简体   繁体   中英

how to change data type sql server 2008 R2

I am trying to change a column from identity(1,1) NOT null to INT NOT NULL?

What is the SQL command to alter this table?

i already try but not success , the data still auto increment.

After altering your column datatype you need to set Identity insert to on for you table, like below.

SET IDENTITY_INSERT YourTableName ON

After this you should be able to insert your values on the column that was an Identity column.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM