AskMe
AskMe

Reputation: 2561

Error converting data type varchar to numeric SQL

I have a column of type DECIMAL(8,0).

I'm trying to update a blank/space/empty sting(' ') based on condition.

update table1 
set col1 = cast('' as decimal(8,0))
where value = '5'

I'm getting this error:

Error converting data type varchar to numeric.

How to update blank/space/empty sting(' ') in the column of decimal datatype?

Upvotes: 0

Views: 632

Answers (1)

D. Foley
D. Foley

Reputation: 1024

You can't convert whitespace to a decimal data type.

Upvotes: 2

Related Questions