I need to change value of NULL-field to empty string (in sales_flat_order table). I tried this code:
$orders = Mage::getModel('sales/order')->getCollection()
->addAttributeToFilter('created_at', array('to' => $endDate))
->addAttributeToFilter('status', array('eq' => Mage_Sales_Model_Order::STATE_COMPLETE));
foreach ($orders as $order) {
$comment = $order->getCustomerNote();
if (is_null($comment)) {
$order->setData('customer_note', '');
try {
$order->save();
} catch (Exception $e){
echo $e->getMessage(); exit;
}
}
}
But in base I see still NULL value in this filed. If I change empty string to any non-empty it works fine. How can I update NULL value field to empty string?
Thanks.