Db2 Sql Error Sqlcode=-108 Sqlstate=42601
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more
Db2 Sql Error Sqlcode 407 Sqlstate 23502
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users db2 sql error sqlcode 440 sqlstate 42884 Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping db2 sql error sqlcode 551 sqlstate 42501 each other. Join them; it only takes a minute: Sign up how can I rename a table in sql db2? up vote 2 down vote favorite I am trying to rename a table in db2 like so rename https://www.ibm.com/support/knowledgecenter/SSEPEK_10.0.0/codes/src/tpc/n108.html table schema1.mytable to schema2.mytable but getting the following error message: the name "mytable" has the wrong number of qualifiers.. SQLCODE=-108,SQLSTATE=42601 what is the problem here.... I am using the exact syntax from IBM publib documentation. db2 rename db2-luw share|improve this question edited Nov 15 '13 at 23:45 WarrenT 3,7781026 asked Nov 15 '13 at 15:08 brucezepplin 1,41582955 add a comment| 5 Answers 5 active oldest votes up vote 7 down vote accepted You cannot change the schema http://stackoverflow.com/questions/20004146/how-can-i-rename-a-table-in-sql-db2 of a given object. You have to recreate it. There are severals ways to do that: If you have only one table, you can export and import/load the table. If you use the IDX format, the DDL will be included in the generated file. If using another format, the table has be created. You can recreate the table by using: Create table schema2.mytable like schema1.mytable You can extract the DDL with the db2look tool If you are changing the schema name for a schema given, you can use ADMIN_COPY_SCHEMA These last two options only create the table structure, and you still need to import the data. After having create the table, you insert the data by different ways: Inserting directly insert into schema2.mytable select * from schema1.mytable Via load from cursor Via a Load or import from file (The file exported in the previous step) The problem is the foreign relations, because they have to be recreated. Finally, you can create an alias. It is easier, and you do not have to deal with relations. share|improve this answer answered Nov 15 '13 at 15:29 AngocA 5,75621744 hi thanks - thought there might be a command to simply move the table into the new schema, but your way of creating a new table in the other schema from the actual table, then inserting does the job for m
your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select http://www.dbforums.com/showthread.php?1094285-DB2-SQL-error-SQLCODE-104-SQLSTATE-42601-SQLERRMC the forum that you want to visit from the selection below. Results 1 to 10 of 10 Thread: DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: Tweet Thread Tools Show Printable Version Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 01-19-05,23:21 #1 sandhyab View Profile View Forum Posts Registered User Join Date Jan 2005 Posts 11 Unanswered: DB2 SQL error: db2 sql SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: Iam getting this errror while using jcc connectivity.All my sql statements are simple select statements.Can you please tell what i shd do to solve this error? Thanks in Advance San Reply With Quote 01-19-05,23:39 #2 Marcus_A View Profile View Forum Posts Registered User Join Date May 2003 Location USA Posts 5,737 What does the Messages and Codes manual say db2 sql error about this? You can download the manuals from the IBM site (see Useful DB2 Stuff thread). M. A. Feldman IBM Certified DBA on DB2 for Linux, UNIX, and Windows IBM Certified DBA on DB2 for z/OS and OS/390 Reply With Quote 01-20-05,00:11 #3 sandhyab View Profile View Forum Posts Registered User Join Date Jan 2005 Posts 11 Thanks for your reply. I checked the sql error in manuals but i didnot understand it. I am getting the following error on this sql statement: Select POLNUM,ACTION,MEMONUM FROM POLMEMO WHERE POLNUM='12239598 'AND MEMONUM = (SELECT MAX(MEMONUM) FROM POLMEMO WHERE POLNUM='12239598 '); Exception in ROLE OR POLMASTN dbconnB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: ;;POLNUM='12239598 ');END-OF-STATEMENT Any suggestions would be appreciated. Reply With Quote 01-20-05,00:15 #4 Marcus_A View Profile View Forum Posts Registered User Join Date May 2003 Location USA Posts 5,737 I don't know anything about jcc, but it looks like there may be a problem with the statement termination character. M. A. Feldman IBM Certified DBA on DB2 for Linux, UNIX, and Windows IBM Certified DBA on DB2 for z/OS and OS/390 Reply With Quote 01-20-05,01:28 #5 sandhyab View Profile View Forum Posts Registered User Join Date Jan 2005 Posts 11 Hi, Thanks, that error was indeed due to the last character.It was running fin