how to get the rowid/rownumbes of a table in sqlserver

Answers were Sorted based on User's Feedback



how to get the rowid/rownumbes of a table in sqlserver..

Answer / payal nath

SELECT ROW_NUMBER() OVER(ORDER BY <FieldName>)
FROM <TableName>

Is This Answer Correct ?    27 Yes 5 No

how to get the rowid/rownumbes of a table in sqlserver..

Answer / renu

Row_number() works on SQL 2005 and upper version, if u r
trying it on 2000 it will not work.

Is This Answer Correct ?    8 Yes 2 No

how to get the rowid/rownumbes of a table in sqlserver..

Answer / vimal

SELECT ROW_NUMBER() OVER(ORDER BY eName ASC) AS Rno, *
FROM emp

asc or desc required

Is This Answer Correct ?    7 Yes 3 No

how to get the rowid/rownumbes of a table in sqlserver..

Answer / vivek

Select Count(*) as ro_no from <tablename>

Is This Answer Correct ?    6 Yes 6 No

how to get the rowid/rownumbes of a table in sqlserver..

Answer / dhivakar

SELECT
ROW_NUMBER() OVER (ORDER BY emp_id) AS rowid,
*
FROM employee

Is This Answer Correct ?    0 Yes 0 No

how to get the rowid/rownumbes of a table in sqlserver..

Answer / samar

hi i had tried same but i am getting error

Server: Msg 195, Level 15, State 10, Line 1
'row_number' is not a recognized function name

here querry is

select row_number() over(order by Income_Verification_id
) from Dim_Income_Verification

plz reply !!

Is This Answer Correct ?    5 Yes 7 No

how to get the rowid/rownumbes of a table in sqlserver..

Answer / raman

If you want row id as ROWID in Oracle, use %%physloc%% to
get unique id for each row in a table.
Ex. Query to get physical address/rowid of first row in
table.
SELECT TOP 1 %%physloc%% AS ROWID FROM <UrTable>

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More SQL Server Interview Questions

Is sql server free?

0 Answers  


Explain the ways to controlling cursor behavior?

0 Answers  


Explain the difference between function and stored procedure?

0 Answers  


How to create a view on an existing table in ms sql server?

0 Answers  


Can you create UNIQUE and PRIMARY KEY constraints on computed columns in SQL Server 2000?

3 Answers   Infosys,






A user is a member of the public role and the sales role. The public role has select permission on all the tables. The sales role does not have select permission on some of the tables will the user be able to select from all tables?

0 Answers  


What is stretch database in sql server?

0 Answers  


How to create new tables with "select ... Into" statements in ms sql server?

0 Answers  


How do I start and stop sql server?

0 Answers  


can i write function in stored procedure and stored procedure in function and nested procedure.Give one example for each question?

1 Answers   Cap Gemini, TCS,


How to Check if table exists in sql server?

0 Answers  


what are different types of backups available in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration

0 Answers  


Categories