Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to log an sql statement

Status
Not open for further replies.

mynwo

Technical User
Jul 12, 2003
75
IN
Dear All,

I am testing on migration from one database to other. I have a file which contains all the database changes (insert/update/delete) that need to be run.
Is there anyway i can log all these statements in to a file. When i run this file and if any of these statement fails can i come to know where the error occured. Thanks in advance.

Regards,

lloyd
 
you may build up a script which calls dbaccess and pipes the output directly to file
 
Hi lloyd,

I agree with appi. Script all your DML statement in a file say my_commands.sh which may look like:

dbaccess testdb <<EOF
begin;
insert ... ;
update ... ;
delete ... ;
rollback;
EOF

To run the command file & capture the results, execute:
sh my_commands.sh > my_output.txt 2>&1

Regards,
Shriyan
 
Hi Shriyan / appi,

Thanks for the feedback

Regards,

lloyd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top