Hello,
I have one query and it's out put is like this.
My database in SQL Server -2000 .
Select Name from table_name
Out Put
========
Name
======
Test1
Test2
Test3
Test4
But I want this types of out put.
Out Put
========
ID Name
=========
1 Test1
2 Test2
3 Test3
4 Test4
Loading

Satyapriya NayakRank #47 · 31.5K reputationPosted Sep 3, 2011, 10:44 AM EDT
Here is your Query
select row_number() over (order by name) as id, Name from table_name
Thanks
If this post helps you mark it as answer
Satyapriya NayakRank #47 · 31.5K reputationPosted Sep 5, 2011, 12:13 AM EDT
If this post helps you mark it as answer
Thanks
Vilas GiteRank #951 · 2.1K reputationPosted Sep 5, 2011, 12:30 AM EDT
Hi Jitendra!
Perfect reply by Satyapriya…
Refer for Syntax…
http://msdn.microsoft.com/en-us/library/ms186734.aspx
Thanks!
-----------------------------------------------------------------------
If this reply helps your post…then check "This is correct answer"
Jitendra Patel138 reputationPosted Sep 15, 2011, 1:22 AM EDT
Is it possible row_number() in Sqlserver 2000.
Satyapriya NayakRank #47 · 31.5K reputationPosted Sep 15, 2011, 3:25 AM EDT
Sorry for the late response.
Actually it is not possible in Sqlserver 2000.But it possible in Sqlserver 2005 onwards.
To do it in Sqlserver 2000 you have to write the below query
SELECT IDENTITY(int, 1,1) AS RowNumber, sname INTO employee1 FROM employee ORDER BY RowNumber ASC
Thanks
If this post helps you mark it as answer
Suthish NairRank #92 · 22.8K reputationPosted Sep 15, 2011, 4:02 AM EDT