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)
 Select Statement

Author  Topic 

tanvirasad
Starting Member

10 Posts

Posted - 2007-03-28 : 01:12:18
I have a Data of E.G 10 Rows And I want To know the row position of the first record in the table fetched by the query. When I run a query " Select ColA, ColB from Tab1 Where ColA = 'TY' " I would like to know the row poition of the above record.

ColA ColB
XY 124
BG 122
YY 129
JK 324
LO 134
TY 824
AF 424
YH 126
WE 200
EN 450
TH 461
YV 551

Tanvir Asad

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-28 : 01:23:16
the row position have no meaning unless you use ORDER BY.




KH

Go to Top of Page

tanvirasad
Starting Member

10 Posts

Posted - 2007-03-28 : 01:28:31
How it helps if I use the Order by clause.

Tanvir Asad
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-03-28 : 01:33:33
Then you can use the new ROW_NUMBER() function available in SQL Server 2005.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -