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 |
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2009-02-26 : 16:50:16
|
| I have the folliwing select query, is it possiblt to have an fake id column with rownumbers in it with the increments of 1.Select id(fakeid), filenames, logtype, project from mytableThank you very much for the helpful info. |
|
|
mfemenel
Professor Frink
1421 Posts |
Posted - 2009-02-26 : 16:56:31
|
| Row_Number can do this. See example.Create table #temp(myname varchar(100))insert into #temp(myname) values('Ted'),('John'),('Steve')select ROW_NUMBER() over( order by myname),myname from #tempMike"oh, that monkey is going to pay" |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-02-26 : 16:59:38
|
| select row_number() over(order by filenames asc) as id,filenames, logtype, project from mytable |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|