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 2005 Forums
 Transact-SQL (2005)
 sql query to show results with serial number

Author  Topic 

pareekfranksoul
Starting Member

26 Posts

Posted - 2008-12-17 : 02:17:25
sql query to show results with serial number

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-17 : 02:21:11
ROW_NUMBER()


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2008-12-17 : 02:21:22
use ROW_NUMBER()
Returns the sequential number of a row within a partition of a result set
Go to Top of Page

pareekfranksoul
Starting Member

26 Posts

Posted - 2008-12-17 : 02:27:44
select ROW_NUMBER(),name from abc

is giving error


Incorrect syntax near 'ROW_NUMBER', expected 'OVER'.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-17 : 02:32:15
Open Books Online help file and read more about syntax and examples of how to use ROW_NUMBER() function.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-17 : 03:00:27
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/08/27/multipurpose-row-number-function.aspx
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2008-12-17 : 04:36:47
select row_number() over (partition by name order by name),* from abc

use partition & order by
Go to Top of Page
   

- Advertisement -