Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > Adding an incremental number to select result
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 18th April 06:29
juan carlos
External User
 
Posts: 1
Default Adding an incremental number to select result


Hi,

I will like to have, along with my quesry result, another
column that will store the number of the row, for example:

1 query results...
2 query results...
3 query results...

how can i do this?

Thanks!
  Reply With Quote


  sponsored links


2 18th April 06:29
vishal parkar
External User
 
Posts: 1
Default Adding an incremental number to select result


Refer to following url
HOW TO: Dynamically Number Rows in a Select Statement
http://support.microsoft.com/default.aspx?scid=KB;EN-US;q186133

if you have any unique field in the table then you can try a query something
like this:
Ex:
use northwind
go
select (select count(customerid) from customers where customerid <=
a.customerid) rank,
*
from customers a
go
--
-Vishal
  Reply With Quote
3 23rd April 16:09
aaron bertrand [mvp]
External User
 
Posts: 1
Default Adding an incremental number to select result


http://www.aspfaq.com/2427

--
Aaron Bertrand, SQL Server MVP
http://www.aspfaq.com/

Please reply in the newsgroups, but if you absolutely
must reply via e-mail, please take out the TRASH.
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666