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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding identity column to existing table

Status
Not open for further replies.

habneh

Programmer
Mar 21, 2007
55
US
Hello everyone

Hope you have a great easter weekend

I have one que

I have a table say tbl1

col1 col2
a xx
a yy
b zz
c ff
c gg

I want to add an indentity column to this existing table
so that it will be like this after I will have added the identity column

col0 col1 col2
1 a xx
2 a yy
3 b zz
4 c ff
5 c gg

How can I do that

Thanks



 
Instead of adding an identity column, I would like to have it like this

when I select a recor from tbl1, I would like to add identity column on the record set. so when I so select * from tbl1

the recordset would be like this

col0 col1 col2
1 a xx
2 a yy
3 b zz
4 c ff
5 c gg
 
What version of SQL is this?

Check out this thread. It has options for both 2000 and 2005.

thread183-1306393

- Paul [batman]
- If at first you don't succeed, find out if the loser gets anything.
 
Thank you very much paul that was a great help
 
no problem.

- Paul [batman]
- If at first you don't succeed, find out if the loser gets anything.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top