Hi All,
I'm having a select statement like this:
Select SName, SDepartment from Department
what I need is that, a select statement which adds a new column RowId
with dynamically generated serial numbers. The output should be like
this:
RowId SName SDepartment
1 Abc CSE
2 Bcd ECE
3 Cde EEE
Thanks in Advance
do you get the answer because me also want to know.
ArunDhaJ wrote:
Select with Row ID
05-Aug-08
Hi All,
I'm having a select statement like this:
Select SName, SDepartment from Department
what I need is that, a select statement which adds a new column RowId
with dynamically generated serial numbers. The output should be like
this:
RowId SName SDepartment
1 Abc CSE
2 Bcd ECE
3 Cde EEE
Thanks in Advance
Regards
ArunDhaJ
Previous Posts In This Thread:
On Tuesday, August 05, 2008 1:32 AM
Plamen Ratchev wrote:
Re: Select with Row ID
On SQL Server 2005 you can use ROW_NUMBER:
SELECT ROW_NUMBER() OVER(ORDER BY SName, SDepartment) AS RowId,
SName, SDepartment
FROM Department;
Plamen Ratchev
http://www.SQLStudio.com
On Tuesday, August 05, 2008 1:36 AM
s wrote:
SQL SERVER 2005Select ROW_NUMBER() OVER(ORDER BY SName) as
SQL SERVER 2005
Select
ROW_NUMBER() OVER(ORDER BY SName) as RowID,
SName,
SDepartment
from Department
HTH,
"ArunDhaJ" wrote:
On Tuesday, August 05, 2008 2:45 AM
Uri Dimant wrote:
HiIs SDepartment unique?
Hi
Is SDepartment unique?
SELECT *,(SELECT COUNT(*) FROM tbl T WHERE T.SDepartment <=tbl.SDepartment )
as Row
FROM tbl
On Tuesday, August 05, 2008 5:01 AM
ArunDhaJ wrote:
Select with Row ID
Hi All,
I'm having a select statement like this:
Select SName, SDepartment from Department
what I need is that, a select statement which adds a new column RowId
with dynamically generated serial numbers. The output should be like
this:
RowId SName SDepartment
1 Abc CSE
2 Bcd ECE
3 Cde EEE
Thanks in Advance
Regards
ArunDhaJ
On Tuesday, August 05, 2008 5:01 AM
ArunDhaJ wrote:
I'm using SQL server 2000. Is there any way to achieve this same?RegardsArunDhaJ
I am using SQL server 2000. Is there any way to achieve this same?
Regards
ArunDhaJ
Submitted via EggHeadCafe - Software Developer Portal of Choice
WPF Reflection Effect
http://www.eggheadcafe.com/tutorials/aspnet/8cc84aa8-3b44-4037-beab-49...6e20b9b >> Stay informed about: Select with Row ID