on 01-26-2014 6:13 AM
Hello Guys,
I am trying to rename a table in db2 which is not part of any schema. Unfortunately i am not able to it. I tried everything but it is not working. What i am doing wrong here ?
My DB2 version is 9.7
db2 => rename table QCM8/B28/XT6D64T to /B28/XT6D64T1
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "rename table" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "<values>".
SQLSTATE=42601
Regards,
Subhash
Hi Subhash
For renaming the table , you need to run the command as :
RENAME TABLE <schema_name>.<table_name> TO <new_name>
Please see the link below
http://publib.boulder.ibm.com/infocenter/db2luw
/v9/index.jsp?topic=%2Fcom.ibm.db2.udb.admin.doc%2Fdoc%2Ft0005369.htm
For finding the schema name of the table :
db2 " select tabschema from syscat.tables where tabname = 'table name' "
Thanks
Rishi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Rishi for your response.
This is the error I am getting. I don't know what I am missing here.
db2 => select tabschema from syscat.tables where tabname='QCM8/B28/XT6D64T'
TABSCHEMA
--------------------------------------------------------------------------------------------------------------------------------
SAPBQ1
1 record(s) selected.
db2 => RENAME TABLE SAPBQ1.QCM8/B28/XT6D64T TO SAPBQ1./B28/XT6D64T1
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token "RENAME TABLE SAPBQ1.QCM8/B28/XT6D64T TO SA" was
found following "BEGIN-OF-STATEMENT". Expected tokens may include:
"<values>". SQLSTATE=42601
db2 =>
Regards,
Subhash
Is your issue resolved subhash ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.