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 |
|
Mondeo
Constraint Violating Yak Guru
287 Posts |
Posted - 2009-01-28 : 09:37:54
|
| Hi,I've imported some data into a table but it doesn't contain any unique ID.I've added a column ID and I want to update it to a sequential ID, i.e. 1,2,3,4 etcHow can this be done? Is there a rowID property or something like that I could use?Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-28 : 09:39:38
|
| just make it an identity columnALTER TABLE tablename ADD columnname int IDENTITY(1,1)... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-28 : 09:40:37
|
| and make sure you dont refer this column in insert & update statements. each insert will automatically increments value of this column so that you dont have to worry about it. |
 |
|
|
Mondeo
Constraint Violating Yak Guru
287 Posts |
Posted - 2009-01-28 : 09:48:46
|
| Great, thanks! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-28 : 09:52:27
|
| welcome |
 |
|
|
|
|
|