Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

RowId In SQL Server

Posted on 2004-04-19
4
Medium Priority
?
11,638 Views
Last Modified: 2009-07-29
How can i get the "RowId" of a table in Sql Server?
0
Comment
Question by:pradeepaga
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1500 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

715 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