Trying to rename a DB2 table with a DATASETS procedure might result in an error


Using a CHANGE statement withing a DATASETS procedure to rename a DB2 table might result in an error. The problem occurs if you are accessing DB2 using SAS/ACCESS® Interface to DB2 under UNIX and PC hosts and a SCHEMA= option was defined in the LIBNAME statement. If a SCHEMA= option was included in the LIBNAME definition, the following error occurs:

ERROR: CLI execute error: [IBM][CLI Driver][DB2/AIX64] SQL0108N The name "XXXX" has the wrong number of qualifiers. SQLSTATE=42601

The problem arises because the schema is included with the new table name in the statement passed to DB2, but DB2 does not allow it. The schema can be included only with the current DB2 table name. The only workaround is to use explicit pass-through and pass the DB2 RENAME statement.