Failing update table in db2 with SQLCODE: -668, SQLSTATE: 57016, SQLERRMC: 7; - sql

I am using db2 9.5 i have created a column in table which is created successfully but i am not able to update table column and getting following error
[Error] Script lines: 1-1 --------------------------
DB2 SQL error: SQLCODE: -668, SQLSTATE: 57016, SQLERRMC: 7;DB2ADMIN.XCATENTRYEXT
Message: Operation not allowed for reason code "7" on table "DB2ADMIN.XCATENTRYEXT".
Following the some blog/sites on google i found the REORG command as solution as mentioned in following link
http://bytes.com/topic/db2/answers/508869-reorg-tablespace
i have tried the following queries to run on database to solve the problem.
Database["DB2"].ExecuteNonQuery("call SYSPROC.ADMIN_CMD ('REORG TABLE DB2ADMIN.XCATENTRYEXT index CATENTRY_ID INPLACE')")
REORG TABLE DB2ADMIN.XCATENTRYEXT index CATENTRY_ID INPLACE
REORG TABLE DB2ADMIN.XCATENTRYEXT
REORG INDEXES I0000908 FOR TABLE DB2ADMIN.XCATENTRYEXT
but all queries have the same error in result like
DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: Database;BEGIN-OF-STATEMENT;<variable_set>
Message: An unexpected token "Database" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "<variable_set>".
I am stuck on this error, I am not even able to update any column of that particular table.

It is possible to do REORG through an SQL statement:
CALL SYSPROC.ADMIN_CMD('REORG TABLE SCHEMA.TABLENAME');

It follows from the error message, that you somehow submit the entire string Database["DB2"].ExecuteNonQuery("call SYSPROC.ADMIN_CMD ('REORG TABLE DB2ADMIN.XCATENTRYEXT index CATENTRY_ID INPLACE')") as a SQL statement, which obviously is incorrect.
Simply issue these on the shell command line:
db2 connect to <your database name here>
db2 REORG TABLE DB2ADMIN.XCATENTRYEXT

If you are using tool like dbeaver , you can go to Schema --> table name --> right click --> select tools and you should see option for reorg table

Related

Cannot create Temporary Table in Hive using Dbvisualizer

When I run the command ->
create temporary table temp_sbm_test as select * from tablename limit 1;
I am getting below error in DBVisualizer.
Can someone explain why the temporary table is going to a database in HIVE database not temporary location?
[Code: 40000, SQL State: 42000] Error while compiling statement: FAILED: HiveAccessControlException Permission denied: user [userid] does not have [CREATE] privilege on [somedatabse/temp_sbm_test]

Trying to add a column to SQL Server table

I am getting incorrect syntax errors with the following statement (SQL Server 2017)
USE ToDo
GO
ALTER TABLE tasks ADD COLUMN completed TINYINT(1);
Started executing query at Line 1
Commands completed successfully.
20:31:38Started executing query at Line 3
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'COLUMN'.
A very similar syntax was used to remove a column that worked fine.
This code would run in MySQL - but not on SQL Server. Consider:
alter table tasks add completed tinyint;
Rationale:
alter table does not support column in SQL Server; just remove that keyword
the tinyint datatype does not take a length

Oracle Error using Toad:

Since a couple of days I can't execute CREATE and TRUNCATE SQL statement using Oracle 12 and Toad 12, ONLY if I terminate my statements with a semicolumn. I've always used the same connections, user and tables, but now I receive these errors while querying:
CREATE TABLE W_TEST_01
AS SELECT *
FROM CFG_FLOW
WHERE 1 = 2;
ORA-00933: SQL command not properly ended
CREATE TABLE W_TEST_01 (PIPPO NUMBER);
ORA-00922: missing or invalid option
TRUNCATE TABLE W_TEST_01;
ORA-03291: Invalid truncate option - missing STORAGE keyword
Can someone please help me?
Try with parentheses, like this:
CREATE TABLE W_TEST_01
AS (SELECT * FROM CFG_FLOW WHERE 1 = 2);
And if it still does not work, try to see the CTAS Tips
I advise you to take a look at the following link
Hope this can help!

Firebird IBOConsole SQL Drop Table if exist not working

I'm pretty new on Firebird.. trying to write a query that drops the table if exists through IBOConsole.
I have written the following sql statement,
EXECUTE block as
BEGIN
if (exists(
SELECT 1 FROM RDB$RELATIONS Where RDB$RELATION_NAME = 'ZZGTTUNIQUEID'))
then
execute statement 'DROP TABLE ZZGTTUNIQUEID';
END
but getting the following result..
ISC ERROR CODE:335544569
ISC ERROR MESSAGE:
Dynamic SQL Error
SQL error code = -104
Unexpected end of command - line 6, column 19
i'm not sure what might be wrong?
In IBOConsole I also experienced problems using the EXECUTE BLOCK statement, resulting in a 'Problem in BindingCursor' message and not executing the statement on the database. Use IBExpert's script executive or FlameRobin instead and it will work.

MySQL - Unable to create column

I am using MySQL 5.1. When i am trying to add new column, it throws error like this,
Database name is "ebill".
Error Code : 1025
Error on rename of '.\ebill\#sql-98_477' to '.\ebill\user' (errno: 150)
(0 ms taken)
This is my sql query:
alter table `ebill`.`user` add column `User_Password` varchar(25) NULL
Where is the issue?
Look here for an answer: What does mysql error 1025 (HY000): Error on rename of './foo' (errorno: 150) mean?.