Don't forget the semi-colon at the end of sql statement. [If you
are just putting the SQL statements inside the file]. Otherwise
you will get the error 'DB21007E'.
The batch file can be
1. either SQL script which contains just SQL statemnets
Like
connect to sample;
select * from some_tab;
This type can be executed by [in simplest form]
db2 -tvf <file-name>
For this type the ending-character [delimitter] is semi-colon.
You can use any special character like @, then that file can be
invoked as
db2 -[Email Address Removed] -vf <file-name.
2. or SQL statements prefixed with db2 like
db2 "connect to test"
db2 "select * from some_tab;"
Note that the statements are not ending with a semi-colon.
This is like a batch file in Windows or Shell-script in Unix and can
be invoked directly by the file name. Of course on Unix, you need to
make the file as executable by 'chmod +x <file-name>' .
Hope this helps.
Partha
-----Original Message-----
From: McClendon Rick
[mailto:db2udbdba-ezmlmshield-x13965675.[Email address protected]
Sent: Thursday, December 30, 2004 8:56 AM
To: LazyDBA Discussion
Subject: RE: How to launch a batch file ?
My guess: Try this from CLP - (OS Linux?)
db2 -tvf snapshot.txt > out3.txt
snapshot.txt would contain "get snapshot for dynamic sql on mcmprd1"
-----Original Message-----
From: Auguy BILOLO
[mailto:db2udbdba-ezmlmshield-x53599435.[Email address protected]
Sent: Thursday, December 30, 2004 10:00 AM
To: LazyDBA Discussion
Subject: How to launch a batch file ?
Hello,
Could you please tll me how to create and launch a DB2 batch file. I
have a
batch file which contains a db2 command as :
db2 get snapshot for dynamic sql on mcmprd1 > out3.txt
When I execute the batch file by right-click and Open it, no thing is
executing
and an error message is showing up.
What I'm doing wrong ? I m limited to launch this file as db2 -f
batch.bat from
the command line processor ?
Augustin
----------------------------------------------------------------
This message was sent using XNETSECURE.COM, the secure Internet
Messaging
System.
---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
DB2 & UDB email list listserv db2-l LazyDBA home page