Help - Reading data from row by row - without using cursor?

  • Hi,

    Table Name - EnergyMeter

    Filed Name - Meter_Id

    Total Records - 6

    using stored procedure - how can read data for row 1, row 2, row 3 ...row 6.?

    Thanks

    ananda

  • Why? What's the goal here?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • ananda.murugesan (10/28/2011)


    Hi,

    Table Name - EnergyMeter

    Filed Name - Meter_Id

    Total Records - 6

    using stored procedure - how can read data for row 1, row 2, row 3 ...row 6.?

    Thanks

    ananda

    For the information given...

    SELECT TOP 6

    Meter_ID

    FROM EnergyMeter

    ORDER BY Meter_ID

    But, I agree with Gail... this smacks of additional requirents you haven't identified. What is it that you're actually trying to do?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 3 posts - 1 through 2 (of 2 total)

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