Alex Rivera | Logout

How do I replace all my NULL values in a particular field in a particular table?

Asked 2011-01-07T19:00:17.013
11

I've looked all over the internet for my answer, and perhaps I'm just doing things wrong. I have a column in my MySQL table that I need to replace all the NULL values with a text string in my SQL Query using phpMyAdmin. I don't want the output to come out that way, I want to actually replace the null values with the text string.

I've tried

UPDATE `tablename` SET fieldname = replace (fieldname, "", "textstring")

I've read up on

SELECT ISNULL(field,"replacetext)

But this only shows the output, but doesn't actually replace it in the table.

I can't figure this out, and I've wasted so much time trying to find an answer.

Edit
Report

1 Answer

6

Have you tried

UPDATE `tablename` SET fieldname = '' where fieldname is null
answered 2011-01-07T19:06:17.810

Your Answer