Tuesday, February 14, 2012

Counter column in the result of SELECT statement

Hi,
I need to have an extra column in my SELECT's result that counts from 1 to
the end of result.
I think I can do it in reporting softwares such as crystal report, but I
want to do this in query analyzer with the SELECT statement, something like
this:
Counter CustomerID Country
1 ALFKI Germany
2 ANATR Mexico
3 ANTON Mexico
4 AROUT UK
5 BERGS Sweden
...
Thanks,
Amin
See if this helps:
http://support.microsoft.com/default...;EN-US;q186133
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Amin Sobati" <amins@.morva.net> wrote in message
news:%23x4ocTDOEHA.3016@.tk2msftngp13.phx.gbl...
Hi,
I need to have an extra column in my SELECT's result that counts from 1 to
the end of result.
I think I can do it in reporting softwares such as crystal report, but I
want to do this in query analyzer with the SELECT statement, something like
this:
Counter CustomerID Country
1 ALFKI Germany
2 ANATR Mexico
3 ANTON Mexico
4 AROUT UK
5 BERGS Sweden
...
Thanks,
Amin
|||Nice article! Thanks!
"Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
news:#SkADeDOEHA.2876@.TK2MSFTNGP09.phx.gbl...
> See if this helps:
> http://support.microsoft.com/default...;EN-US;q186133
> --
> HTH,
> Vyas, MVP (SQL Server)
> http://vyaskn.tripod.com/
> Is .NET important for a database professional?
> http://vyaskn.tripod.com/poll.htm
>
> "Amin Sobati" <amins@.morva.net> wrote in message
> news:%23x4ocTDOEHA.3016@.tk2msftngp13.phx.gbl...
> Hi,
> I need to have an extra column in my SELECT's result that counts from 1 to
> the end of result.
> I think I can do it in reporting softwares such as crystal report, but I
> want to do this in query analyzer with the SELECT statement, something
like
> this:
> Counter CustomerID Country
> --
> 1 ALFKI Germany
> 2 ANATR Mexico
> 3 ANTON Mexico
> 4 AROUT UK
> 5 BERGS Sweden
> ...
>
> Thanks,
> Amin
>
>

No comments:

Post a Comment