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 |
|
pritesh_b
Starting Member
1 Post |
Posted - 2003-05-23 : 06:10:03
|
| HiI had to alter a table to add a numeric primary key. I have about 2000 records which i need to add the numeric value to the ID Column i.e. 1,2,3,4,5,6,7,8,9,10Is it easy to create a loop for that?thanksPritesh |
|
|
dsdeming
479 Posts |
Posted - 2003-05-23 : 07:57:35
|
| It's easy to create a loop, but this sound like a case where adding an identity column would be the perfect solution. The rows would have numbers assigned to them automatically as soon as the column was added, and all rows inserted subsequently will get unique integer keys as well. See ALTER TABLE in BOL. It has an example of adding an identity column. |
 |
|
|
|
|
|