Reputation: 135
Datatype of column1 is money
, I would like to replace 0 with empty.
I have tried the following, but it still shows 0
CASE
WHEN column1 = 0
THEN ''
ELSE column1
END
This is in SQL Server 2012.
Upvotes: 0
Views: 386
Reputation: 23174
The column needs to be nullable, and then you can simply use NULL
CASE WHEN column1 = 0 THEN NULL ELSE column1 END
Upvotes: 0
Reputation: 2063
Use NULL instead
CASE WHEN column1 = 0 THEN NULL ELSE column1 END
Upvotes: 1