Delete with no log in DB2

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
thurmy34
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 31, 2006 8:27 am
Location: Paris

Delete with no log in DB2

Post by thurmy34 »

Hi,
I would like to perform a huge delete inside Datastage.
I have to handle the log of the database.
I know the db2 command and it's works with a call to a .cmd file.
I have some issue with the ' caractere who disappear between datastage and my cmd.(ex Date_1='01/01/2007' in datastage become Date_1= 01/01/2007 in my cmd and the sql failed).
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Where are you calling this command? And what is the command about? What is the full log that shows you this info?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
thurmy34
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 31, 2006 8:27 am
Location: Paris

Post by thurmy34 »

Kumar,
I call the delete.cmd in a Before routine.
The delete.cmd create a sql file and execute it like that
DB2CMD.EXE /w /c DB2.EXE -tvf FicSql -l FicLog
The sql file cotains

Code: Select all

UPDATE COMMAND OPTIONS USING C OFF;
CONNECT TO DB1 USER USR1 USING xxxx;
ALTER TABLE DBM02.IFCE_IFC_CD_ECRITURES_COMPTABLE ACTIVATE NOT LOGGED INITIALLY;
DELETE FROM DBM02.IFCE_IFC_CD_ECRITURES_COMPTABLE 
WHERE (month(D_TRAITEMENT)!=12 and day(D_TRAITEMENT)!=31)
 or (D_TRAITEMENT= 01/01/2007 ); <-- here i lost the '
COMMIT;
DISCONNECT CURRENT;
TERMINATE;
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Re: Delete with no log in DB2

Post by I_Server_Whale »

thurmy34 wrote:ex Date_1='01/01/2007' in datastage
How about enclosing '01/01/2007' in single quotes like below:

Code: Select all

''01/01/2007''
. Four single quotes.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
thurmy34
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 31, 2006 8:27 am
Location: Paris

Post by thurmy34 »

If i do that (''01/01/2007'') db2 looks for a column named 01/01/2007 and it's doesn't work.

Anyway, for some reasons the other guys in my team thought that i can't do that in the DB2 API.
I test it and it works.
In the before tab I have

Code: Select all

ALTER TABLE DBM02.IFCE_IFC_CD_ECRITURES_COMPTABLE ACTIVATE NOT LOGGED INITIALLY; 
DELETE FROM DBM02.IFCE_IFC_CD_ECRITURES_COMPTABLE 
WHERE (month(D_TRAITEMENT)!=12 and day(D_TRAITEMENT)!=31) 
 or (D_TRAITEMENT= #MyDate# )
So now it okay for me.
Thanks for Helping.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

And who in the world told you that it will not work in the before sql tab. Never 'assume'. Test it out yourself first before confirming any one else's notion. Anyways, thanks for the info, you can now mark your post as resolved.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply