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.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Row_number()

Author  Topic 

wided
Posting Yak Master

218 Posts

Posted - 2014-04-17 : 04:17:26
Hello

I need to have a sequential record number :

select RecordNumber, col1, col2 from table1 ...

What should write as RecordNumber (Row_number())

I need to have this result

Num col1 col2
1 v1 v11
2 v2 v22
3 v3 v23
4 v4 v23

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-04-17 : 05:00:19
[code]row_number() over (order by col1, col2) as RecordNumber[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

wided
Posting Yak Master

218 Posts

Posted - 2014-04-17 : 05:46:02
thanks
Go to Top of Page
   

- Advertisement -