Hi,
I am using the following code for order by
But when I set @IsOrderByAccno =0 it works fine. but when I set @IsOrderByAccno =1 then it generating an error message "Conversion failed when converting datetime from character string.". I think this is due to the use of different datatypes in the order by . Please help me..
I am using the following code for order by
Code:
SELECT * FROM TBLTEST ORDER BY CASE WHEN @IsOrderByAccno=0 THEN testDate ELSE testname END
Comment