Hi everyone
i want to retrive the row number of result of "Select" Statement.
Thanks
Mehdi
Mehdi wrote:
> Hi everyone
> i want to retrive the row number of result of "Select" Statement.
> Thanks
> Mehdi
That's a slightly obscure question. It could mean any of several
things:
You want to iterate a result set and return a number for some row - You
can do that client side using ADO recordsets.
You want to know the number of rows returned by the last SELECT
statement - The @.@.ROWCOUNT function will tell you that.
You want to return a row number for each row in a SELECT statement -
Use the ROW_NUMBER, RANK or DENSE_RANK function in your query (assumes
SQL Server 2005).
Something else? Then give us some more detail please.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment