Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 remove identity colomn in table

Author  Topic 

amirs
Constraint Violating Yak Guru

260 Posts

Posted - 2010-10-09 : 11:27:04
Dear member

please tell me how to remove identity column in the table by script in the SQL2008.

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-10-09 : 13:17:30
[code]ALTER TABLE tableNameHere DROP COLUMN columnNameHere[/code]

If the column is indexed, or referenced by a key, you will first need to drop the index/key
Go to Top of Page

amirs
Constraint Violating Yak Guru

260 Posts

Posted - 2010-10-09 : 14:11:39
thanks to replay
but colomn is not null or blank it is some value.
i will not delete colomn value. i will remove only idetity

Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-10-09 : 15:22:56
either add a new column, copy the values to it and drop original, or create a new table and pump all the data to the new table, drop old, rename new table to original name
Go to Top of Page
   

- Advertisement -