Row numbers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamesd0142
    Contributor
    • Sep 2007
    • 471

    #1

    Row numbers

    I have a basic query such as...

    [code=sql]
    SELECT WBLTP_Payment
    FROM DS_WBLTP_Paymen t
    [/code]

    this shows data like..

    <colunmname>
    12
    13
    14
    15

    QUESTION:
    How can i get row numbers also so my result looks like this...

    <ID><colunmname >
    1 12
    2 13
    3 14
    4 15
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    i don't think there's a record/row number that's automatically created in sql server. if you really need to, read this:





    -- CK

    Comment

    • Jim Doherty
      Recognized Expert Contributor
      • Aug 2007
      • 897

      #3
      Originally posted by jamesd0142
      I have a basic query such as...

      [code=sql]
      SELECT WBLTP_Payment
      FROM DS_WBLTP_Paymen t
      [/code]

      this shows data like..

      <colunmname>
      12
      13
      14
      15

      QUESTION:
      How can i get row numbers also so my result looks like this...

      <ID><colunmname >
      1 12
      2 13
      3 14
      4 15
      What version SQL Server are you using?

      Jim

      Comment

      • jamesd0142
        Contributor
        • Sep 2007
        • 471

        #4
        im using SQL server 2000

        Comment

        • Jim Doherty
          Recognized Expert Contributor
          • Aug 2007
          • 897

          #5
          Originally posted by jamesd0142
          im using SQL server 2000
          OK just wondered because SQL Server 2005 took this on board with 'row_number over' it doesnt exist in 2000 so go with ck9663s post

          Jim :)

          Comment

          • jamesd0142
            Contributor
            • Sep 2007
            • 471

            #6
            Yes, id appriciate some help if possible, tried for hours on this and still no good.

            Thanks

            for example:

            table contains several columns

            table: users

            column names: fName, lName, Login, password

            Comment

            Working...