in reply to Counter and select statement

pfaut++.

However, for others who may want to create a select statement with Sybase that numbers each row you can do it like this:

select row_num identity(5), col1, col2, col3, ... into #tmp from the_table where some_condition select row_num, col1, col2, col3, ... from #tmp order by row
This creates a temporary table with the first column being auto-generated and incremented for each row.

Off course it's usually easier to do this as the rows are fetched from the database, but in some cases it's nice to have this option.

Michael