rowid is there?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vinod
    New Member
    • Aug 2006
    • 40

    rowid is there?

    Hi experts,
    I'm in need to use the rowid of a column.
    is there any concept like rowid?

    for example, i need the first row of a table.or 5th row of a table.how can i write the query?


    thank you verymuch in advance.
  • ramasp
    New Member
    • Sep 2006
    • 19

    #2
    Originally posted by vinod
    Hi experts,
    I'm in need to use the rowid of a column.
    is there any concept like rowid?

    for example, i need the first row of a table.or 5th row of a table.how can i write the query?


    thank you verymuch in advance.
    select top 1 * from tablename

    Comment

    • ramasp
      New Member
      • Sep 2006
      • 19

      #3
      Add a column of int datatype to the existing table. Define identity on that column. Define Identity seed and identity increment as 1,1.
      The following is the syntax.

      a int identity(1,1). Here a is the column. SQL Server automatically increments the number. Based on that number you can fetch the desired record.

      Comment

      • vinod
        New Member
        • Aug 2006
        • 40

        #4
        Using Identity function is really great friend.
        I'm trying for my purpose now, if i need some more assistance, i'l come back to you

        Comment

        • Nyiti
          New Member
          • Jan 2008
          • 1

          #5
          Hi there!

          Try this:
          select CityID,
          c.CityName,
          ROW_NUMBER() OVER(ORDER BY c.CityName, c.CityID desc) AS RowID
          from City AS c

          So you can manage the multiple columns ordering too.

          Bye!
          Nyiti

          Originally posted by vinod
          Hi experts,
          I'm in need to use the rowid of a column.
          is there any concept like rowid?

          for example, i need the first row of a table.or 5th row of a table.how can i write the query?


          thank you verymuch in advance.

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            rowid purely is a concept of oracle.

            Comment

            Working...