ALTER TABLE MALZEME.KATEGORILER ALTER COLUMN ID DROP IDENTITY ;
EXPORT TO "D:\PROGRA~1\IBM\SQLLIB\WEBCPTAB.IXF" OF IXF MESSAGES
"D:\PROGRA~1\IBM\SQLLIB\WEBCPTAB.EXM" SELECT * FROM MALZEME.KATEGORILER;
CONNECT TO PERSONEL;
IMPORT FROM "D:\PROGRA~1\IBM\SQLLIB\WEBCPTAB.IXF" OF IXF MESSAGES
"D:\Program Files\IBM\SQLLIB\copy.txt" CREATE INTO MALZEME.KATEGORILER IN USERSPACE1;
I copied a table which has auto-generated identity as I wrote above.
But I want to write conditional expression like this:
if given table's column's identity is 'Y'
alter (drop identity)
alter (addd identity)
in my application I copy all tables of selected database.So automatically it must control if a table has auto -generate identity before exporting and importing.
I wnt write sql commands to do it.I can copy the tables by db2 commands but I dont know how to add this condition to my commands.
I still do not understand what the purpose of this is. You example shows exporting out of the source DB and creating the table on the destination DB from the export ixf. If all you are doing is exporting from a table on the source DB then there is not need to do anything about identity columns for that table on the source DB. You are just reading rows.
while exporting you are true.there is no need to drop auto-generate identity.
rows are read and export.
But while importing if you dont drop this identity rows are rejected.You can nopy the table structure with import command but not data.