View previous topic :: View next topic
|
Author |
Message |
Hritam
New User
Joined: 27 Jun 2005 Posts: 36 Location: India
|
|
|
|
Hi,
We have altered a Db2 table and added 5 more columns in the last.
There is an existing insert query which inserts into this table but does not have these new 5 columns.
This insert query is in CICS screen.
Will this insert query in CICS screen work fine without the new 5 columns ?
Thanks |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Will this insert query in CICS screen work fine without the new 5 columns ? |
That will depend on the definition and usage of these new fields.
It may also happen that your current screen will insert rows without the new fields, but that other processes later may have problems.
It is a good idea for an insert to make sure all of the fields have an acceptable value. |
|
Back to top |
|
|
Hritam
New User
Joined: 27 Jun 2005 Posts: 36 Location: India
|
|
|
|
Thanks d! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
If the fields allow NULL values it will be fine, but all those extra 5 columns will contain NULL. If they are defined to not allow NULL your insert will fail. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Steve,
won't NOT NULL WITH DEFAULT take care of that problem? As long as the OP is ok with 5 columns with zeros or spaces in the 'unmentioned' columns. |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
I stand corrected. I'm not a DBA, I only play with them and forgot about the default on columns even though I deal with it every day. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
When you add new columns to an existing table the new columns either have to be null or not null with default. An insert that worked before the columns were added will work afterwards. |
|
Back to top |
|
|
|