Determining row numbers in recordset

  • I need to show the row number for recordsets in functions, procedures, and views. This number will be used for formatting rows in user interface to show different colors for alternating rows 

  • So you want the first column of a returned recordset to be row number?  Not straightforward via T-SQL (although I'll wait for someone here to prove me wrong!).  I would expect this sort of thing to be done by the front end app.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • It can be done... but it's the job of the presentation layer.

    Just declare a int and increment it in the while not MyRs.EOF() and format using that variable.

  • Err wait, Nevermind. Cant Read

    Edit:

    If you want to do something like this you are adding a ton of overhead onto the sql server. and if you allow client side sorting you are guaranteeing the need to hit sql server on each postback and it will make each procedure more complex because of the need for a "Dynamic" Order by.

  • Don't the recordset tools have order methods in 'em?? Why don't we use 'em?? .

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply