Solved

RowId In SQL Server

Posted on 2004-04-19
4
11,572 Views
Last Modified: 2009-07-29
How can i get the "RowId" of a table in Sql Server?
0
Comment
Question by:pradeepaga
  • 2
4 Comments
 
LVL 12

Expert Comment

by:ill
Comment Utility
sql server 2000 doesn't support rowID.
0
 
LVL 13

Accepted Solution

by:
danblake earned 500 total points
Comment Utility
There is no such thing as a RowId of a table in sql-server as an inbuilt function there is something called ROWGUIDCOL but this is something completly different.
Yukon is going to introduce a RowID functionality that is the similar to Oracle's RowId property
(RowID is an Oracle function -- that does not exist in SQL-Server).

This is normally acomplised in SQL-Server by adding an identity column (1,1) and calling it RowId
(But I wouldn't want to call it a RowID -- reserved word).

0
 
LVL 13

Expert Comment

by:danblake
Comment Utility
Have a look here for the identity column implementation:
http://www.sql-server-performance.com/forum/topic.asp?TOPIC_ID=3385

0
 
LVL 34

Expert Comment

by:arbert
Comment Utility
I agree that the identity method is usually the easiest way.  If you don't already have an identity column on your table, you can always insert into  a temp table and return the results.  If you do already have an identity column on your table and you can't have a gap between the numbers, you could also create a UDF that joins back to your original table and sequence the records that way.

Brett
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now