Solved

RowId In SQL Server

Posted on 2004-04-19
4
11,577 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
ID: 10858344
sql server 2000 doesn't support rowID.
0
 
LVL 13

Accepted Solution

by:
danblake earned 500 total points
ID: 10858375
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
ID: 10858382
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
ID: 10859274
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

920 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

15 Experts available now in Live!

Get 1:1 Help Now