Re: Identity or Sequence column in non-table SELECT ?



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)
.



Relevant Pages

  • Identity or Sequence column in non-table SELECT ?
    ... 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. ... The Identity function can do this, ... Prev by Date: ...
    (microsoft.public.sqlserver.mseq)
  • Re: select @@IDENTITY from MyTable
    ... @@identity function will return the "last inserted" identity value in the table. ... the sequence of identity values.) ... have to make use of function @@rowcount. ... Vishal Parkar ...
    (microsoft.public.sqlserver.programming)
  • Re: What do you know that the rest of the world doesnt?
    ... assumption - that sequence similarities necessitate common decent via ... In the simplest sequence evolution ... Designer didn't specify at design-time (though, perforce, He had to ... those functions that have a greater minimum threshold requirement. ...
    (talk.origins)
  • Re: Cohens paper on byte order
    ... the external data model to a bit stream, ... comparable standards do specify external data ... sequence, and which therefore does not provide guidance ... standard character codes). ...
    (sci.crypt)
  • Re: What do you know that the rest of the world doesnt?
    ... assumption - that sequence similarities necessitate common decent via ... deliberate design. ... In the simplest sequence evolution ... Designer didn't specify at design-time (though, perforce, He had to ...
    (talk.origins)