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 |
|
pgmr1998
Yak Posting Veteran
66 Posts |
Posted - 2010-07-29 : 15:16:46
|
| Anyone know how I can generate a sequential number and have it as my first col during my Select Clause? I would like to begin with the number 1 and have it increment by 1 for each output line. Thanks... |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2010-07-29 : 15:24:58
|
| Look into the ROW_NUMBER() function. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-29 : 16:50:09
|
selectrow_number() over (order by (select 1)) as rownum,*from your_table No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|