Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: RE: displaying limited number of rows
Date: Mar 23 2001 5:58PM

Pantera, Joseph F. writes:
 > Follow-on question along these lines (probably easier, although I know how
 > to do this in Oracle, but not Sybase)...  If I want to place a  column
 > number next to the output from a query indicating where I am at in the
 > output such as a list of names:
 > Column1:  Column2:
 > 1         Name #1
 > 2         Name #2
 > 3         Name #3
 > .           .
 > .           .
 > .           .
 > N         Name #N
 > How do I do this in my query?

I think you can do this by playing with identity(), but you
have to do a select into, like so:

select column1 = identity(5), column2 into #t from table where ...
select * from #t

This can be run as a single command.

I don't think there is any way to dynamically number a result set with
Sybase (no pseudo-rownum value).

Michael Peppler - Data Migrations Inc. - -
International Sybase User Group -
Sybase on Linux mailing list: