It depends on the database you connect to. Often, you either INSERT NULL or you simply do not specify the column, sometimes, both methods are allowed.

To insert NULL into the database, you use undef as value (which is also what you get back when reading NULL values).

Alexander

Pai Peng wrote:
In my project I first prepare an INSERT statement 'INSERT INTO table
(col1, col2, col3, ...) VALUES (?, ?, ?, ...)' once, then insert
multiple records using 'execute(@values)'. The problem is that not all
values of all columns are available. So I should either leave them empty
or set them as default values. I try to use 'NULL' or 'DEFAULT' for
those unavailable values in '@values', but it didn't work. I know I
probably can set '0' for numerical columns and 'space' for varchar
columns. But is there a simpler way so I don't need to worry about data
types?

Thanks,

Pai



--
Alexander Foken
mailto:[EMAIL PROTECTED]  http://www.foken.de/alexander/

Reply via email to