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 |
|
trouble2
Constraint Violating Yak Guru
267 Posts |
Posted - 2007-12-19 : 08:41:27
|
| Hi, I've got a simple question, and I think I've seen it somewhere before, but I can't find it.I want to do a select and return a column with the record number in it.SO Select [something] as Number, column2, column3, etc.Would return:1 Column2, Column32 Column2, Column33 Column2, Column3The secret to creativity is knowing how to hide your sources. (Einstein) |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-12-19 : 08:43:54
|
[code]select row_number() over (order by somecol) as Number, Column2, Column3, etcfrom yourtable[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|