473,537 Members | 2,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can i drop a cloumn from a table in DB2 for Z/OS

Can i drop a cloumn from a table in DB2 for Z/OS?
Jun 27 '08 #1
4 12895
On 4 Cze, 09:58, Joseph <josephrathin...@gmail.comwrote:
Can i drop a cloumn from a table in DB2 for Z/OS?
If you mean 'alter table so that it has one column less' AFAIK you
cannot :(, this is not Informix, i'm afraid

regards
Z
Jun 27 '08 #2
Zbikow wrote:
On 4 Cze, 09:58, Joseph <josephrathin...@gmail.comwrote:
Can i drop a cloumn from a table in DB2 for Z/OS?

If you mean 'alter table so that it has one column less' AFAIK you
cannot :(, this is not Informix, i'm afraid

regards
Z
Yup, that's correct - neither DB2 8 nor DB2 9 for z/OS support ALTER
TABLE DROP COLUMN (IIRC, DB2 9 for LUW introduced it, although it was
also possible(ish) from within the control center on DB2 8 for LUW).

One possibility for doing this is to export+drop+recreate+import, e.g.
assuming a table called TABLE1 with columns COL1, COL2, and COL3, you
could do something like this to drop COL3:

EXPORT TO data.ixf OF IXF SELECT COL1, COL2 FROM TABLE1;
DROP TABLE TABLE1;
CREATE TABLE TABLE1 (COL1 ..., COL2 ...);
IMPORT FROM data.ixf OF IXF INSERT INTO TABLE1;

(can't use IMPORT ... CREATE as it's not supported with DB2 for z/OS
IIRC)

Alternatively, you could try using a "NO DATA" MQT to accomplish this:

CREATE TABLE TABLE2 AS (SELECT COL1, COL2 FROM TABLE1) WITH NO DATA;
INSERT INTO TABLE2 SELECT COL1, COL2 FROM TABLE1;
DROP TABLE1;
RENAME TABLE2 TO TABLE1;

Either way, you'll need to be careful to recreate any indexes /
constraints on the new table that existed on the old one.
Cheers,

Dave.
Jun 27 '08 #3
Either way, you'll need to be careful to recreate any indexes /
constraints on the new table that existed on the old one.

Cheers,

Dave.
....as well as grants on the table, they're lost too. This is a thing
that one can easily forget. You need to extract grants from DB2
catalog beforehand.

regards
Zbikow

Jun 27 '08 #4
On Jun 4, 8:14 pm, Zbikow <zbik...@wp.plwrote:
Either way, you'll need to be careful to recreate any indexes /
constraints on the new table that existed on the old one.
Cheers,
Dave.

...as well as grants on the table, they're lost too. This is a thing
that one can easily forget. You need to extract grants from DB2
catalog beforehand.

regards
Zbikow
Thanks a lot guys.
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
33365
by: James Knowlton | last post by:
Hello, I'm just returning to MS SQL Server after two years of dealing with Sybase ASE. I need to drop a column, using the alter table command. I keep getting an error indicating that a constraint is using the column. Here is the create script for the table create table mytable (col1 char(1) not null, col2 char(1) default 'A' not null )
10
26062
by: BuddhaBuddy | last post by:
Platform is DB2/NT 7.2.9 The table was created like this: CREATE TABLE MYTEST ( MYTESTOID bigint not null primary key, FK_OTHEROID bigint not null references other, FK_ANOTHEROID bigint not null references another, FK_LASTLYOID bigint not null references lastly, unique (FK_OTHEROID,FK_ANOTHEROID))
1
1807
by: adolph | last post by:
I I've added a column to a table using a sql statement IE "ALTER TABLE sometable ADD COLUMN Direction" Now I would like to limit the valid entries for the field to North;East;South;West; How do I do this with a SQL statement?
5
51448
by: Markus | last post by:
I tried this: ALTER TABLE Dokumente DROP COLUMN docPrioID but I get this errormessage: DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: COLUMN;ABLE Dokumente DROP;CONSTRAINT
4
9276
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me if it works, and if it does not, tell me why it does not work. Thanks.
1
5058
by: sparksol | last post by:
I have a form with a drop down box. If you select an option in the drop down box (depending which option is selected) one or two textbox(es) and a submit button display. I would like to keep the textbox(es) and the submit button showing until another option is selected. Also the data that's submitted is showing on the form page. Here's an...
5
13739
by: Romulo NF | last post by:
Greetings, I´m back here to show the new version of the drag & drop table columns (original script ). I´ve found some issues with the old script, specially when trying to use 2 tables with drag&drop on the same page (which was not possible). Now i´ve a new concept of the script, more object oriented. I´ve also commented the whole code so you...
2
1073
by: =?Utf-8?B?aUhhdkFRdWVzdGlvbg==?= | last post by:
I have to retrieve the cloums from the table, but there are few columns in a table of datatype date and int and the default values are 9999-12-31 23:59:59.997 and -2147483648. My questions is when I retreive them I sould get value as NOTHING, i mean blank. Can any one give me the solution.
10
49588
by: Dean | last post by:
My client has a db I am working that uses temp tables. During an update procedure, I had the code If fTableExists(tempTblName) = True Then DoCmd.DeleteObject acTable, tempTblName Then I thought of using: If fTableExists(tempTblName) = True Then CurrentDb.Execute "DROP TABLE " & tempTblName Is there an advantage to either? What really be...
0
7300
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7687
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7644
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5826
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3347
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1759
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
927
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
582
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.