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.
| Author |
Topic |
|
spock
Starting Member
35 Posts |
Posted - 2002-08-01 : 07:39:28
|
| HiI have a table like create table #a (empid int,names varchar(30))i add some records into this table.I want to now change the empid column to a identity column and preserver the existing empid's . how do i do it ?Thankskaushik |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2002-08-01 : 11:32:43
|
| just set it to identity in EM table designer..PeaceRick |
 |
|
|
spock
Starting Member
35 Posts |
Posted - 2002-08-01 : 23:59:01
|
| thanks Rickbut i was wondering how would you write a query for that.ThanksKaushik |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-08-02 : 08:13:48
|
| You'd have to:-create a new table with the same structure but with an identity column-set identity_insert on and then insert the data into the new table-drop the old table-rename the new table to the old nameThis is more or less what EM does behind the scenes. |
 |
|
|
|
|
|