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
 Transact-SQL (2000)
 Dynamic Order By problems

Author  Topic 

Zippeh
Starting Member

9 Posts

Posted - 2004-05-21 : 06:16:06
After reading some other threads on here and trying things out, I am still stuck!!

Any idea where I'm going wrong??


ORDER BY

CASE @order WHEN 'ASC' THEN
CASE@criteria
WHEN 'enw' THEN provider_id
WHEN 'tref' THEN provider_town
WHEN 'math' THEN pdtype_type_id
END
END ASC,

CASE @order WHEN 'DESC' THEN
CASE @criteria
WHEN 'enw' THEN provider_id
WHEN 'tref' THEN provider_town
WHEN 'math' THEN pdtype_type_id
END
END DESC

LarsG
Constraint Violating Yak Guru

284 Posts

Posted - 2004-05-21 : 07:27:08
What's the problem?

apart from the missing space in this CASE@criteria
Go to Top of Page
   

- Advertisement -