From: Matthias R. <mat...@so...> - 2006-07-12 22:02:33
|
How can I insert rows into a table with some column values coming from a query and the rest being set to their defaults? insertQuery generates SQL of the form INSERT INTO table (SELECT ...) This doesn't allow default values to be specified because a) the SELECT must produce as many columns as there are in the table, b) it is illegal to write something like 'SELECT DEFAULT,..'. By contrast INSERT INTO table(column,...) (SELECT ...) will give default values to all the columns that do not appear in the column list. However, from my experimenting and looking at the code it appears that there is currently no way to construct such a query. Would it be possible to add this? I suspect one difficulty might be expressing the record typing constraints required to make this operation safe. Matthias |