I have a table with 100 columns. I want to sort on each column. My Front-end decides which column is to be
used for sorting. There are more than 500,000 records in the table.
My stored procedure has a input which decides which column to use for sorting. Now i have two options.
1. Create SQL Query dynamically based on the input parameter.
2. Create SQL Query using CASE statement.
Is there any third way? Also, which one would really work better? CASE statement would have SP's plan created. But,
if i use CASE statement, maintenance would be difficult.