DB2 — update many Rows at once

Latelty I had to play around with Content Manager and DB2 as the database software.

DB2 is really nice, although it is annoying as backspace is not working in my environment. God knows why, I honestly did not care.

Stuff that i stumbled accross were some nice DB2 tasks to update many rows at once with a tool called “db2batch”.
The usage within DB2 is a bit odd for me:
Update rmobjects set obj_stgclassid=12 where obj_itemid=’OB123asdSD23′ where obj_mgtclassid=12
What really annoyed me on this syntax is the fact, that the obj_itemid had to be in ‘ ‘. The other values did not need this.
For the db2batch you use following syntax to start it:

db2batch -d <databasename> -f /<filename> -a <user>/<password> -r /<filenameforresults>

It will, if the SQL statement is correct, do the stuff that is in <filename>.
You can check the result in <filenameforresults>.
If you need to change anything within DB2 and the setup is made by ContentManager first do “db2 list command options” to check if autocommit is switched on.

 

Advertisements
This entry was posted in aix, Commonstore, Content Manager, DB2 and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.