Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Empty string Sql Update

I am trying to update these empty space records to empty strings but even if say it updated doesn't update. I run command over and over again it still says X rows affected. data type var char(2) I converto to nvarchar(2) still same

UPDATE Foo SET Boo = '' where Boo = ' '

(21297 row(s) affected)

MS Sql 2012

like image 718
Mert Avatar asked Apr 14 '26 12:04

Mert


1 Answers

Try with the below query.

  UPDATE Foo 
   SET Boo = '' 
  WHERE replace(Boo,' ','')= ''
like image 126
Unnikrishnan R Avatar answered Apr 16 '26 00:04

Unnikrishnan R



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!