Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Dymanic Order By

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-06-01 : 07:27:37
Sridhar writes "Team,

I am doing paging in the backend (will return only required record for the page not all the records) and showing data in asp.net datagrid. In order to enable the sorting of columns in datagrid, I need to pass 'ORDER BY' clause as parameter to SP. Building case statement is not possible there are more colums and to be handled in more store procedures. Is there any other solution for this? Can anyone assist me on this Please.

Thanks in Advance
Sridhar"

nr
SQLTeam MVY

12543 Posts

Posted - 2004-06-01 : 14:06:03
If you can't use a case statement then I don't see any option other than dynamic sql.
You can order by the column position so if you could make sure the sort columns are first you could
order by 1,2,3

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -