Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

218 Posts

Posted - 04/17/2014 :  04:17:26  Show Profile  Reply with Quote

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

In (Som, Ni, Yak)

17689 Posts

Posted - 04/17/2014 :  05:00:19  Show Profile  Reply with Quote
row_number() over (order by col1, col2) as RecordNumber

Time is always against us

Go to Top of Page

Posting Yak Master

218 Posts

Posted - 04/17/2014 :  05:46:02  Show Profile  Reply with Quote
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000