given this statement: select column1, column2, column3, column4 from thetable order by (case @OrderBy when 1 then column1 when 2 then column2 when 3 then column3 when 4 then column4 end)this is what i'm doing now:if @Desc = 1 select column1, column2, column3, column4 from thetable order by (case @OrderBy when 1 then column1 when 2 then column2 when 3 then column3 when 4 then column4 end) DESCelse select column1, column2, column3, column4 from thetable order by (case @OrderBy when 1 then column1 when 2 then column2 when 3 then column3 when 4 then column4 end)
is there a way to have it be sorted by desc within the case statement? or do I have to have it split out into two selects, with one adding the desc?Edited by - danielhai on 09/11/2002 19:22:21Edited by - danielhai on 09/11/2002 19:22:38