Reputation: 13
I have numeric values like below:
0
2323
1003
I have to replace only single zeros to 100. I tried the following code but it affects the other values which include 0.
UPDATE table_name SET field_name= replace(field_name,"0","100");
The values should be like below after the transaction:
100
2323
1003
Which SQL command should I use?
Thanks.
Upvotes: 0
Views: 38
Reputation: 49260
You should use a where
clause instead of replace
.
UPDATE table_name SET field_name = 100
where field_name = 0
Upvotes: 1