If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to use m switch in SQL script ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-05-09, 09:41
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
How to use m switch in SQL script ?

Hi Guys,

How can I use -m switch in middle of my SQL script.

I used this while running this script as
Quote:
db2 -mtvf DelRows.SQL
But I need a few rows of long script to show me how many rows were affected.

Code:
:
:
----need to switch m ON
insert into trans_history select * from trans where trans_id < current date - 21 days;

export to trans_history.ixf of ixf select * from trans where trans_id < current date - 21 days;

delete from trans  where trans_id < current date - 21 days;

----need to switch m OFF
:
:
:
Is there a way to do it. -m switch does not work using UPDATE COMMAND OPTIONS USING m ON

Any help is appreciated.

Thanks
DBFinder
Reply With Quote
  #2 (permalink)  
Old 11-05-09, 20:20
db2dummy1 db2dummy1 is offline
Registered User
 
Join Date: Feb 2009
Posts: 114
We could talk about using "UPDATE COMMAND OPTIONS" if only it worked as advertised ....

=> db2 update command options using m off
SQL0104N An unexpected token "off" was found following "OFF". Expected
tokens may include: "ON". SQLSTATE=42601

=> db2 update command options using m on
SQL0104N An unexpected token "on" was found following "ON". Expected tokens may include: "A". SQLSTATE=42601
Reply With Quote
  #3 (permalink)  
Old 11-05-09, 21:09
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Seems to match:
IBM IZ08431: THE DB2 UPDATE COMMAND OPTIONS USING 'M' OFF/ON RESULTS IN SQL0104N ERROR - United States


It's said to be fixed in v9.5 fp2+. I tried it on fp5 and got the same error...
Reply With Quote
  #4 (permalink)  
Old 11-05-09, 21:16
db2dummy1 db2dummy1 is offline
Registered User
 
Join Date: Feb 2009
Posts: 114
That's ok - we can wait until V10 for such a substantial fix
Reply With Quote
  #5 (permalink)  
Old 11-06-09, 04:25
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Seems that no body paid much attention on that.
Any way, I am splitting script in sections.

Code:
db2 -tvf script1.sql
db2 -mtvf script2.sql
db2 -tvf script3.sql
That works already. My point to share was to find if anybody had any better workaround.

I still need another workaround for Task Center Schedules.

Thanks for your attention.

DBFinder
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On