tsql row count question

liunx

Guest
Hi i was curious if there is a way to return row number thats been returned,

like
select 'a', SomethingReturnsIT from table

now the result would look like

'a' 1
'a' 2
'a' 3

and so on it has to count one by one, for any kinda result.
Any ideas, i know i can use .nets coding but this would be much easier if there is a way to do it.forgot to ask one more thing
im gereally doing

select top 20 * from table

in this selection how can i learn how many rows it would return if there wasnt any top 20 limitation on it.

I doing a search result screen thats why im asking a best way to page these out. The queries are big and i dont want it to be ran twice to get the count. Thanks in advance,
 
Back
Top