Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I alter an identity field to not be an identity field using T-SQL?

Status
Not open for further replies.

sedrisco

Programmer
Oct 25, 2001
12
US
I have a number of tables that use an identity field as a primary key. I need to change the key of the table, and I'd like to leave the original key in the table, but to no longer be an identity field. Is there a way to do this using T-SQL? I tried the following, but it's not removing the identity propery:

alter table table1
alter column [table_id] bigint not null

Any suggestions?

Thanks!
 
Thanks. I was hoping there was a way to do it without recreating the table, or adding a new field. I didn't realize that what Enterprise Manager did was recreate the table. I guess I will do that programatically.

Thanks again for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top