Your query have dynamic column you order the resultset by that Column,How can you
sort the resulset.
It is a interview question.
What is answer.
The answer is SQL allows the number in order by cluase
If your query is like this
"Select EmployeeId,EmployeeName,Address from Employee order by EmployeeName"
Our query is
"Select EmployeeId,EmployeeName,Address from Employee order by 2"
But this case only for Dynamic columns .Not for standard columns.
"select getdate(),id from table1 order by 1"
above is suitable for correct example
Saturday, September 12, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment