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)
 autogenerate key

Author  Topic 

Arun.G
Yak Posting Veteran

81 Posts

Posted - 2010-05-06 : 00:32:18
I have created master table with ID column as primary key and inserted records to all tables

Now i want that ID column to be autogenrated

i tried with design tool, and alter procedures , it doesnt work

how to alter the table ID colums to autogenrate key without disturbing the existing datas


ex:


i tried the follwing:

alter table <tblname> alter <ID> integer identity(20,1)
(if there is already 19 records means)

im new to sqlserver, can u pls suggest me the eaiest way to solve this issue

malpashaa
Constraint Violating Yak Guru

264 Posts

Posted - 2010-05-06 : 02:51:09
The short answer is you can't. But for details on how to deal with such problem refer to:
[url]http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/04d69ee6-d4f5-4f8f-a115-d89f7bcbc032[/url]
Go to Top of Page
   

- Advertisement -