A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

db2 batch scripts – tips and tricks – part 2

I’ve always been a little frustrated with db2 when running scripts and command lines with fact that when a command would run like insert, update or delete, you never knew how many rows you affected.  Some GUI products will tell you, but with command line it would just come back as being successful (or not) and it was up to you to validate what you really did with a subsequent query.

Being a DBA, I always feel the need to validate what I do especially with ad hoc statements to ensure that I have done what I expected.

Enter the m option on the db2 command line.  This is a relatively new switch that will cause db2 to return to you how many rows were affected. The m option was introduced with verison 9.

To do this from the command line:

db2 -m “delete from test” will return

  Number of rows affected : 18
DB20000I  The SQL command completed sucessfully.

To do this from a script:

db2 -tvmf test.db2

By doing this, you will have the number of rows affected at your finger tips, not more hoping or assuming or doing count before/count after!

Happy DBAing

1 comment to db2 batch scripts – tips and tricks – part 2

Leave a Reply

Buy Generic Viagra USA
Where TO Buy Viagra Online
Buy Viagra Where
Cheap Cheap Viagra
Line Viagra
Buy Discount Viagra
Cheapest viagra online Pills
Buy Viagra Sample
Cheap Viagra Online
Cheap Viagra FAST Shipping
Viagra for Sale
Buy Viagra New York
Cheap Websites For Viagra
Viagra FOR Sales Online
Cheapest Viagra Prices
Cheap Viagra Pills