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

Can we join two tables without primary key?

0 Answers  


If we drop a table, does it also drop related objects like constraints, indexes, columns, defaults, views, and stored procedures?

1 Answers  


Different types of keys in SQL?

0 Answers   Infosys,


Do you know the different ddl commands in sql?

0 Answers  


tell me what is blocking and how would you troubleshoot it? : Sql server database administration

0 Answers  






can any one say how to update the following senario I have a table <srabank> in which the table structure is as follows ANAME ACCNO LOCATION ACCTYPE BAL SBanuPrakash 31518746291 Punganur deposit 4000 Sreenivas 31518746292 mahoobnagar current 14000 Ranjith 31518746293 Karimnagar Savings 2000 Giresh 31518746294 Chennai deposit 40000 Boo 31518746295 Chennai Savings 20000 Jay 31518746296 Valachari Savings 1000 tirumalraj 31518746297 Vellore Savings 8000 The senario is We need to select one account number and check the balance after checking the balance if the balance exist we need to transfer to another account . in the from account the amount need to be reduced and in the to account the amount needed to be added. for example for the <accountno> <31518746291> the balance is <4000> for the <accno> <31518746292> the balance is <14000> after transferring the balance the details will look as follows <accno><31518746291> <bal> <2000> <accno><31518746292> <bal> <16000> the above mentioned two statment will come under the final result.

3 Answers  


What is the difference between mysql and mysqli?

0 Answers   HCL,


What is SubQuery in SQL Server 2008

0 Answers   HCL,


What happens if we shrink log file in sql server?

0 Answers  


Which trace flags are enabled in sql server?

0 Answers  


What is resultset concur_updatable?

0 Answers  


Does sql server use java?

0 Answers  


Categories