Tuesday, January 22, 2013

selecting objects in DB2 with a slash in them

Not having worked with DB2 for a while, I found myself in a bind today.
One of the developers had tried installing a package from somewhere, and it created a lot of objects with slashes in them. Like /DEV1/WEIRD_OBJECT and /DEV/WEIRD_OBJECT_V

After an attemt at uninstalling these I was asked to help. And I was kind of puzzled at first about why someone would use a command interpreted character in an objectname. But overcomming this obstacle was nonetheless my task. A simple command db2 "drop table tablename" didn't really do the trick. Looking at the manual just gave me todays first headache. Searching with bing and google returned no viable results, other than a lot of critism about using slashes in objectnames and some helpful hints for Oracle. Had this been oracle, the problem would have been much simpler. Just use double quotations.

I didn't have this option in DB2, because I have to send the command in the double quatation to begin with !

In the end I ended up using single AND double quotations like: db2 "select viewschema,viewname from syscat.views where viewname like '/DEV1/WEIRD%' "
That gave me a nice overview of the views (you can guess the command to view the tables :D ) and then it's just rinse and repeat for the drop commands.....

Headache is still here, but now at least the problem is gone....

Monday, January 14, 2013

Altering SQL procedures in an SAP system

The other day I was stupified by a note from SAP. I had an SQL error 8115

SQL 8.115: [Microsoft][SQL Server Native Client 10.0][SQL server]
Arithmetic overflow error converting numeric to data type varchar.

This was caused by dbacockpit. And I even found a nice note about it, number 1638567, which states that I just had to be on a certain release level (and lets face it, who is ?), but if all else fails, I could just go to transaction SE38 and fix it in the report MSSPROCS.

Now the problem was the this report no longer showed me the MSSQL procedures (!)

But I found that it was still possible to change the procuderes by going to transaction DB02, and expanding the "configuration" view. Under here there's a menuitem "SQL Script Maintenance". Here I found the script I needed "sap_dbcc_opentran", and just pressed change. Voila. 


There was the magic number that I needed to change. And presto.... Gone was the error.
It's still weird though, that SAP doesn't update their notes with relevant information about how to implement their changes. Espcially, if they remove previously available options.