日期:2014-05-18 浏览次数:20539 次
go create proc pro_tracy @P1 int as if @P1=1 begin Select a, b, c from table1 order by a end if @P1=2 begin Select a, b, c from table1 order by b end if @P1=3 begin Select a, b, c from table1 order by c end
------解决方案--------------------
还可以使用order by case when @P1=1 then a when @P1=2 then b when @P1=3 then c end