0

I'm trying to convert the values from the column Debit; if the values is blank it should convert to 0 otherwise it should convert the value to a decimal.

Here's what I've done so far:

  CONVERT(Decimal(18, 2), (CASE Debit WHEN ' ' THEN 0 END)

It works, but I want to retain the value if its not a blank. How would I do that?

2
  • 1
    did not get what you are trying to do .. please elaborate Commented Jun 10, 2014 at 10:40
  • try this CONVERT(Decimal(18, 2), REPLACE(Debit, ' ', '0')) suggested by ahillier88 Commented Jun 10, 2014 at 10:43

1 Answer 1

2

Something like this?

CONVERT(Decimal(18, 2), REPLACE(Debit, ' ', '0'))
Sign up to request clarification or add additional context in comments.

1 Comment

yeah..something like that..tnx buddy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.