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.
| Author |
Topic |
|
royv
Constraint Violating Yak Guru
455 Posts |
Posted - 2001-11-21 : 12:36:45
|
| I was reading the article on Dynamic Order By, but I cannot get it to work. I get a conversion error. Here is my code {NT4 SP6 SQL7-SP2):create procedure spdynamicorderby @pintSortBy int=nullasselect account,accountnumberfrom tblwhateverwhere account='whatever'order by case @pintSortBy when 1 then account when 2 then accountnumber else account end ascWhen @pintSortBy=1, I get a 'Syntax error converting varchar value to int'. When @pintSortBy=2, it works fine. Any suggestions?*************************Just trying to get things done |
|
|
|
|
|