i have a table #temp1(id, Name groupname ) and record
like this 1 R1 S
2 R3 S
3 R2 S
4 R4 D
5 R5 D
6 R6 K
7 R7 K
8 R8 L
9 R9 L
10 R10 L
11 R11 K

and i want to display record based on user defind sorting
order e.g.
1 R4 D
2 R5 D
3 R6 K
4 R7 K
5 R11 K
6 R1 S
7 R3 S
8 R2 S
9 R8 L
10 R9 L
11 R10 L

Answer Posted / veeresh kethari

SELECT ROW_NUMBER() OVER(ORDER BY GROUPNAME ASC) ID
,NAME,GROUPNAME FROM REC ORDER BY GROUPNAME

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How we create SQL Server 2005 Reporting Services ? Give me Sample

1568


What is normalization of database? What are its benefits?

511


how can you attach more than 20 ldf files in sql server

1565


what is the different types of backups available in sql server? : Sql server database administration

497


What is instead of trigger sql server?

491






Which are the two editions in which SQL Azure database available?

99


What is a scheduled job or what is a scheduled task?

533


What is the use of custom fields in report?

552


How to transfer a table from one schema to another?

555


What are the encryption mechanisms in sql server?

572


How to create a scrollable cursor with the scroll option?

492


What is named query? : sql server analysis services, ssas

507


what is the main function of a query parameter?

111


Explain filtered indexes benefits?

593


What is in place upgrade in sql server?

511