Re: using DEFAULT with update
Posted in 2003
Gorazd Hribar Rajteri' wrote: >>I tried to update and insert by using the DEFAULT keyword explicitely as > > it > >>is possible with some DBMS. I know that I can use CURRENT year to second >>directly with the update clause, but I was just wondering if there is >>something similar to "update TABNAME set COLNAME = DEFAULT" > > > Default values are used only in INSERT statements, if column for which > default value is defined, is not initialized or if you're trying to insert a > NULL value in that column. No, that's totally wrong! The default value only gets used if you DON'T insert a value into a column. If you want to insert an unknown (NULL) value into a column, then you can, and the default does not override it. The only way to use the default is to omit the column from your INSERT statement altogether. Cheers, -- Mark. +----------------------------------------------------------+-----------+ | Mark D. Stock mailto:mdstock@MydasSolutions.com |//////// /| | Mydas Solutions Ltd http://MydasSolutions.com |///// / //| | +-----------------------------------+//// / ///| | |We value your comments, which have |/// / ////| | |been recorded and automatically |// / /////| | |emailed back to us for our records.|/ ////////| +----------------------+-----------------------------------+-----------+ sending to informix-list