Re: Identity or Sequence column in non-table SELECT ?
- From: Hugo Kornelis <hugo@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 02 Jun 2005 22:07:05 +0200
On Thu, 2 Jun 2005 12:44:02 -0700, GlennM wrote:
>I'm looking for a way to specify a column in a SELECT statement
>that is a sequence number related to the record number in the result set.
>Ideally, just a number from 1 to N.
>Example:
>Select <???> as Sequence, column1, column2 from table1
>
>The Identity function can do this, but only for SELECT INTO
>a new table. I don't want to create a new table.
>
>The NewID() function returns a new global ID, but those
>are not sequential.
>
>I was hoping there might be some special variable @@XXX
>that represents the row number in the results, but could not find
>anything like that in the SQL Server documentation.
>
>Any ideas ?
>
Hi Glenn,
http://www.aspfaq.com/show.asp?id=2427
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
.
- References:
- Identity or Sequence column in non-table SELECT ?
- From: GlennM
- Identity or Sequence column in non-table SELECT ?
- Prev by Date: Re: filtering groups
- Next by Date: extreme help with query of 2 tables into 1 long table
- Previous by thread: Re: Identity or Sequence column in non-table SELECT ?
- Next by thread: extreme help with query of 2 tables into 1 long table
- Index(es):
Relevant Pages
|
|