Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

row number.

0 views
Skip to first unread message

David Mackintosh

unread,
May 16, 2004, 9:39:20 PM5/16/04
to
All I am trying to do is return the row number (calculated field?)
with each row returned from an SQL query. I think I have done this in
the past but am a bit rusty after not using SQL for a while. If
anyone could help with a code snippet this would be gretly
appreciated.

David Portas

unread,
May 16, 2004, 9:54:41 PM5/16/04
to
Here's an example from the Pubs database:

SELECT
(SELECT COUNT(*)
FROM Authors
WHERE au_id <= A.au_id) AS rownum
,*
FROM Authors AS A

--
David Portas
SQL Server MVP
--


Zach Wells

unread,
May 16, 2004, 11:46:17 PM5/16/04
to

There are now row numbers.

Zach

Joe Celko

unread,
May 16, 2004, 11:46:34 PM5/16/04
to
>> All I am trying to do is return the row number (calculated field?)
with each row returned from an SQL query. <<

Since this would have to be for display purposes in the front end, you
ought to be doing in the front, not the database.

--CELKO--
===========================
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

0 new messages