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)
 Dynamic Order By

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-07-24 : 08:32:35
Kate writes "This is about stored procedures. I am interested in not only having the column that the results are ordered in, be dynamic, but also have whether or not the results are in "DESC" order be dynamic.

The following code doesn't work-- it's what I've been trying...

ORDER BY CASE WHEN @Sort = 'd' Then CompName
WHEN @Sort = 'f' Then Part
Else SalesRep
End
CASE WHEN @Order = 'DESC' Then DESC
END

Thanks,
Kate"
   

- Advertisement -