I ran across an old message, and since the thread went a bit astray and apparently unresolved, I chose to post a resolution as a new message, instead of a reply to an '06 msg. I chose to respond to what Rob had pointed out as appearing suspect in http://archive.midrange.com/midrange-l/200609/msg01271.html

rob wrote:
> <<SNIP>>
>
> I even tried this:
>
> CREATE TABLE JEFF1
> (MYCHAR CHAR (15 ) NOT NULL WITH DEFAULT
> ,MYDEC DECIMAL (9 , 2) NOT NULL WITH DEFAULT)
>
> CREATE TABLE JEFF2 as
> (Select * from JEFF1)
> WITH DATA RCDFMT JEFF1
>
> And their record formats were different.

To get the same record format level identifier as the TABLE referenced in the SELECT, for the given CREATE TABLE, requires an additional SQL clause to be appended to the CREATE TABLE:
INCLUDING DEFAULTS

Note: Alternate syntax is INCLUDING COLUMN DEFAULTS
Note: The default is EXCLUDING COLUMN DEFAULTS

If the referenced table had an Identity column, there is a similar clause, similarly with alternate syntax, and also /excluding/ as default:
INCLUDING IDENTITY

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/db2/rbafzmsthctabl.htm

Regards, Chuck

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].