Inserting NULL value with db_query OR db_write_record
The NULL that you're passing is possibly/probably being interpreted as a string, ie. "NULL". When MySQL casts that to a float the result is 0.

If you have a default value for the column you can just leave it out of the query altogether, and you'll get the results you expect:

db_query("INSERT INTO {foo_bar} (name) VALUES ('%s')", $name_value);


or

$obj_foo_bar = new stdClass();
$obj_foo_bar-&gt;name = 'Dollar'
// Leave out $obj_foo_bar-&gt;amount

drupal_write_record($table, $obj_foo_bar);