I've got a few one-off data fixes to do. I have to do them all in RPG: though the client has SQL, they don't really know how to use it, so they don't want me using it. Also, they consider it dangerous.
Don't know SQL? Don't know SQL! SQL has to be the single most ubiquitously useful and transferable skill in IT. If you don't know SQL, and know it well, learn it now.
I can't recommend any introductory books on SQL, but I can recommend Joe Celko’s SQL for Smarties. At an advanced level, it's the only SQL book you'll need. (Platform specific stuff, you say? Don't use it.)
Dangerous? Well, yes, it's dangerous. You can indeed hose a lot of data very quickly with SQL. But then, screwing up a database with a compiler takes only a little longer. Both approaches are as safe as one another; test thoroughly, and you'll be fine. And doing the data fix right is usually quicker with SQL, too.
One piece of advice, though; no matter how sure you are that your SQL statement is right, test your query one more time over tha actual data that you are going to update before running the update.
Once upon a time, in the dim and distant past, I had a big live data update to perform. So, on the test system, I constructed test data, ran and printed a bunch of queries, wrote my SQL statement, re-ran my queries to show that the update has worked properly, cut-n-paste my SQL statement into a Word document, printed that, and dumped the whole lot onto my bosses desk to check. He gave the go-ahead, so I opened up a session on the live box, set (and double checked) my library list, cut-n-paste my SQL statement from the Word document into the live session, hit enter, and went for a cup of tea.
It was only when I got back to my desk that I realised that the last cut-n-paste had left all the 'not' symbols ('¬'s) behind. Thank God for journals. The system was down for several hours, though. Sigh.Posted to iSeries by Simon Brunning at May 05, 2004 02:35 PM