Page 1 of 1

Setting Null to a nullable decimal column

Posted: Tue Feb 21, 2012 8:14 am
by srinivas.nettalam
Is that true that if we use SetNull() to a nullable decimal field ,it goes as 0.00 in to database???I really felt wierd when most of the people said that.

Posted: Tue Feb 21, 2012 8:33 am
by chulett
Why not test that theory yourself? Sounds all kinds of wrong to me.

Posted: Tue Feb 21, 2012 8:46 am
by DSguru2B
Sometimes the database columns have default values set. Maybe thats in play here.

Posted: Tue Feb 21, 2012 8:52 am
by chulett
You have to not mention a column in your DML for the default value to be used, setting it to null will cause it to be null regardless of the default. That's true for Oracle and I'm assuming other databases as well.

Posted: Tue Feb 21, 2012 8:59 am
by DSguru2B
In DB2 it depends how the DBA has set it. There are conditional values on inserts as well.
Test it out as Craig mentioned. Drop the records in a dataset or flat file and see what the values are. If it shows up null there then there is something on the database side.

Posted: Tue Feb 21, 2012 9:02 am
by srinivas.nettalam
thanks all for your replies..I am getting NULLs in database.I was confident enough but the counters were many.Hence I posted but yes it is my fault to post it before testing on my own