View Full Version : How Do I set empty fields as NULL?

04-21-2009, 06:24 PM
I've got a whole bunch of empty values in the MFG field of my stock table, and I need to make them NULL.

I don't really even know where to start.
Any pointers?

My first thought:

UPDATE Stockline
WHERE mfg :confused:

~ Mo

04-21-2009, 06:27 PM
try a "show create table Stockline" and post the result.

best regards

04-21-2009, 06:46 PM
Well if mfg is a string column:

UPDATE SET mfg=null WHERE mfg = ''

Also remember to backup the table before you do wide sweeping changes like this.

If there are ones with spaces or tabs you'd like to replace with null, that can be done with a trim function.

04-21-2009, 07:04 PM
Thanks oracleguy, that now seems painfully obvious.

And thanks for the reminder to backup, as well as the suggestion of trim for tabs and spaces.

~ Mo