Monday, July 1, 2013

Displaying Hexadecimal or integer value in report based on condition

I am getting #Error when using the following code to display the column MachineId based on the paramter @DisplayMachineId-



CASE @DisplayMachineId
WHEN 1 THEN CAST(MachineId AS VARBINARY(8))
ELSE CAST(MachineId AS SQL_VARIANT)
END AS 'MachineId'



I cannot do this in Report Level as it is having heavy performance issue. It's working when @DisplayMachineId is false i.e. value =0 but when value is 1 then am getting #Error as output.




Regards,

Karthik



Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread.


No comments:

Post a Comment