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
Suthish NairPosted Sep 15, 2011, 8:02 AM
Satyapriya NayakPosted Sep 15, 2011, 7:25 AM
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
Jitendra PatelPosted Sep 15, 2011, 5:22 AM
Is it possible row_number() in Sqlserver 2000.
Vilas GitePosted Sep 5, 2011, 4:30 AM
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"
Satyapriya NayakPosted Sep 5, 2011, 4:13 AM
If this post helps you mark it as answer
Thanks
Satyapriya NayakPosted Sep 3, 2011, 2:44 PM
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