Case Statement - End with a Blank Value

Bone_12 361 Reputation points
2021-09-08T16:27:22.097+00:00

Hi,

I have a Case Statement but to close it off, I have

else ' ' end as 'Variable_Name'

This then still outputs a 0 but I want it to be blank. Any idea how I can do this please?

SQL Server | Other
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 122.6K Reputation points
    2021-09-08T16:32:10.173+00:00

    Try casting the expressions that appear before else, for example:

    ā€ƒ... then cast(Co_Numeric as varchar(max)) else ' ' end as 'Variable_Name'

    Sometimes you can use NULL instead of ' '.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.