none
Displaying Hexadecimal or integer value in report based on condition

    Question

  • 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.

    Monday, July 01, 2013 9:32 AM

Answers

  • I have resolved the issue by creating a new function for getting the HEX value and now the report is working as expected.

    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.

    • Marked as answer by V Karthik Monday, July 01, 2013 10:55 AM
    Monday, July 01, 2013 10:54 AM

All replies

  • I have resolved the issue by creating a new function for getting the HEX value and now the report is working as expected.

    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.

    • Marked as answer by V Karthik Monday, July 01, 2013 10:55 AM
    Monday, July 01, 2013 10:54 AM
  • Hi Karthik,

    Glad to hear that your issue has been solved, thank you for sharing the useful information.

    Regards,
    Charlie Liao

    If you have any feedback on our support, please click here.


    Charlie Liao
    TechNet Community Support

    Tuesday, July 02, 2013 1:13 AM
    Moderator