View Full Version : How Do I set empty fields as NULL?
04-21-2009, 05: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.
My first thought:
WHERE mfg :confused:
04-21-2009, 05:27 PM
try a "show create table Stockline" and post the result.
04-21-2009, 05: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, 06: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.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.