in reply to How to insert a NULL value into a table!!
You generally insert a null into a column from perl by using a parameter of undef. You are not using parameters; you are interpolating your perl scalars into a SQL strings. You should seriously think about using parameters.
If you are saying $id->{Cluster} can be undef then why didn't you get an error when you attempted to use it in your do statement - have you got "use warnings" in your script.
If a column has a default value and you want the default value applied then you must omit that column from the insert.
I see you are using SQL Server, but just in case you use other databases too you should be aware that some of them consider the empty string to be NULL e.g., Oracle.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to insert a NULL value into a table!!
by misterwhipple (Monk) on Nov 13, 2009 at 14:22 UTC |