Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2002
    Location
    Brazil - Rio de Janeiro
    Posts
    7

    Question Unanswered: How to get a similar value to Oracle's ROWID?

    Hi everyone,

    I'm trying to find out how to get the following SQL statment on SQL Server:

    select max(rowid) from temp_tab1;

    N.B.: The sql above was run on an Oracle DB to return the max row id given by the server (not the table's primary key). I know I can get a similar result if I query my primary key, but that's not the case. I need the DB row id given.

    Any help is welcome,
    Regrads,
    Bruno.

  2. #2
    Join Date
    Dec 2001
    Location
    Toronto, Canada
    Posts
    335
    RowID is a built in feature that is created with every table in ORACLE. For SQL Server you would need to create a column in your table with the property of IDENTITY, check Book On Line. This is a system maintained column.
    MCDBA

  3. #3
    Join Date
    Mar 2002
    Posts
    34

    SQL Server equivalent of Oracle rownum

    select ms_ident from table

  4. #4
    Join Date
    Dec 2001
    Location
    Toronto, Canada
    Posts
    335
    Where did you get that - ms_ident? I tried this out and it doesn't work. I've looked in BOL and searched the web, but there is no reference to ms_ident. Is it a typo?
    MCDBA

  5. #5
    Join Date
    Jun 2002
    Location
    USA
    Posts
    21
    Hi ,

    The Data Storage concept / Architecture in SQL Server is entirely different from that of Oracle.

    There is no ROWID Concept in SQL Server.

    But, there is something similar to that you can achieve using "Globally Unique Identifiers" (ROWGUIDCOL property)

    For more information, See BOL.

    Again , I like to say that please dont compare ROWID Concept with this. Both are not same.

    Have Fun.

    Varad01

  6. #6
    Join Date
    Dec 2001
    Location
    Toronto, Canada
    Posts
    335
    ROWGUIDCOL, is a bit of an over kill. It doesn't generate numbers but globally unique identifier (GUID), like 6F9619FF-8B86-D011-B42D-00C04FC964FF. This is mainly used with replication, when tables from different sites need to merge data.

    Look at the IDENTITY property which will generate numeric values. A column with this property is maintained by the system. See Books Online for more information.
    MCDBA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •