Handy SQL-generating scripts to add to your toolbox
Systems Engineering and RDBMS blog: More DB2 LUW SQL Scripts
If you're just getting started with DB2, you may be thinking about the never-ending list of DB2 statements that you execute just to carry out your DBA duties. Generating those statements from short SQL queries (typically one or two lines, tops) against various SYSCAT views has got to be one of the most laudable manifestations of laziness. Aside from saving tremendous amounts of time (especially for databases with lots of objects), this approach also helps to cut down on typos, since you're not entering nearly as many commands by hand. The scripts in the blog post cover some of the most common DB2 tasks, and an earlier post from the same blog includes a few more. If you're not already generating most of your repeatable DB2 commands from scripted queries against the catalog, it's never too early or too late to take that plunge. Do it, and you'll never look back.