tags:

views:

25

answers:

1

I saw some topics about this, but the problem is that the solutions required a "switch case"... Like this

I have a table with a lot of columns, is there a way to do a dynamic sort without the switch?

+1  A: 

No.

Unless you use dynamic SQL.

Or you can use ROW_NUMBER() to generate some arbitrary sequences to sort on... but this is no different to CASE just moves the complexity around.

To be honest, if I had one of 10 columns to sort on, I'd make it happen on the client in a sortable grid...

gbn