SQL Bulk copy when doing write to server throws exception - sqlbulkcopy

I am trying to do bulk copy using SqlBulkCopy.WriteToServer. It gives me an exception. Cannot create a row of size 8635 which is greater than the allowable maximum row size of 8060.
The statement has been terminated. Can someone please explain me what this is ?

Related

index was out of range must be non negative and less than the size of the collection when generating script with data

I am trying to generate the script with data i am getting
index was out of range must be non negative and less than the size of the collection in sql server when generating script with data. How can i resolve this issue.
To get script with data i doing following steps
right click on database.
Task - Generate Script
Select table .
Select specified database object
Select Table
Select Advance The select type of database script to script data
Press Next Then Next to start

When i run a specific query i get , ORA-00604: error occurred at recursive SQL level 1 ORA-12899: value too large for column"PLAN_TABLE"."OBJECT_NAME"

Am using Oracle 12.1 c when i run specific query ( i cant show for security reason , and because its un related); i get exception
ORA-00604: error occurred at recursive SQL
level 1 ORA-12899: value too large for column "SOME_SCHEMA"."PLAN_TABLE"."OBJECT_NAME"
(actual: 38, maximum: 30)
I cant make it work , i will try revert last changes i did because it was working before.
BTW i was doing Explain and doing index optimizations
Any idea why!
P.S i will keep trying
How i solved this:
When i was reverting and reviewing my last changes i was doing alters for adding indexes, and each time i try to run the query again to make sure it is working.
So when i reached a specific alter i noticed the name of the index is too long,
so even if the index was created successfully, but the explain plan for select
was failing not the select it self.
The solution:
I renamed the index to be shorter ( 30 maximum ) it worked
Change table/column/index names size in oracle 11g or 12c
Why are Oracle table/column/index names limited to 30 characters?
Using EXPLAIN PLAN Oracle websites docs

DB2 ERRORCODE=-4229, SQLSTATE=null

I'm getting this error while executing a batch operation.
Use getNextException() to retrieve the exceptions for specific batched elements.ERRORCODE=-4229, SQLSTATE=null
I'm not finding any pointer to proceed with debugging this error.
Appreciating any help!!!
Search for the error on the IBM page:
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2z10.doc.java%2Fsrc%2Ftpc%2Fimjcc_rjvjcsqc.htm
-4229 Message text: text-from-getMessage Explanation: An error occurred during a batch execution.
User response: Call SQLException.getMessage to retrieve specific
information about the problem.
So, it might be related to any underlying error during the execution of your batch insert/update/delete
For those who are looking for an solution to this error.
For me this was due to
THE INSERT OR UPDATE VALUE OF FOREIGN KEY constraint-name IS INVALID.
DB2 SQL Error: SQLCODE=-530, SQLSTATE=23503
In my case, this occurred because I had an unique covering index defined on two columns and the combination of these two values was not unique when I was inserting the records.
For anyone who is still wondering, try entering a unique record and check if the error still persists?
For me it was because of duplicate entry of a foreign key.
In my case, this was due to having rows in the database with the same PK IDs that the sequence was generating. The solution can be to fix these "future" row IDs or adapt the sequence to jump those numbers.

DB2 400 drop column

I want to drop a column called id which is an auto incrementing PK.
The SQL:
alter table "CO88GT"."XGLCTL" drop column id cascade;
And I get:
Error: [SQL0952] Processing of the SQL statement ended. Reason code 10.
SQLState: 57014
ErrorCode: -952
I could be wrong but I think it has something to do with preventing the table from losing data. To get around this issue I need to create a new table without the column and copy the data from the old table into the new table and then replace the old table with the new table.
Info
AS400 is giving you a warning (inquiry message) because of possible data loss, asking you to Cancel or Ignore the requested operation. So, beacuse of this being a interactive request, over JDBC/ODBC you cannot type 'I' to ignore, and AS throws you an ErrorCode: -952 with SQLState: 57014 and Reason code 10.
In the documentation of SQL0952 says:
Message Text: Processing of the SQL statement ended. Reason code &1.
Cause Text: The SQL operation was ended before normal completion. The reason code is &1. Reason codes and their meanings are:
* 1 - An SQLCancel API request has been processed, for example from ODBC.
* 2 - SQL processing was ended by sending an exception.
* 3 - Abnormal termination.
* 4 - Activation group termination.
* 5 - Reclaim activation group or reclaim resources.
* 6 - Process termination.
* 7 - An EXIT function was called.
* 8 - Unhandled exception.
* 9 - A Long Jump was processed.
* 10 - A cancel reply to an inquiry message was received.
* 11 - Open Database File Exit Program (QIBM_QDB_OPEN).
* 0 - Unknown cause.
If you are using JDBC and the SQL error isn't self-explanatory, you can make a JDBC connection with parameter 'errors=full', which will give much more info on the error. For other connection parameters see this.
example connection string:
jdbc:as400://serverName;libraries=*libl;naming=system;errors=full;
With that connection the resulting error would be like this:
Error: [SQL0952] Processing of the SQL statement ended. Reason code 10.
Cause . . . . . : The SQL operation was ended before normal completion.
The reason code is 10.
Reason codes and their meanings are:
1 -- An SQLCancel API request has been processed, for example from ODBC.
2 -- SQL processing was ended by sending an exception.
3 -- Abnormal termination.
4 -- Activation group termination.
5 -- Reclaim activation group or reclaim resources.
6 -- Process termination.
7 -- An EXIT function was called.
8 -- Unhandled exception.
9 -- A Long Jump was processed.
10 -- A cancel reply to an inquiry message was received.
11 -- Open Database File Exit Program (QIBM_QDB_OPEN).
0 -- Unknown cause.
Recovery . . . : If the reason code is 1, a client request was made to cancel SQL processing. For all other reason codes, see previous messages to determine why SQL processing was ended.
SQLState: 57014
ErrorCode: -952
The solution
So finally, if you cannot use STRSQL, another solution is to use iSeries Navigator, to be exact its "Run SQL scripts" (it is usually here --> "%Program Files%\IBM\Client Access\Shared\cwbundbs.exe").
But first of all you have to add a system reply parameter (only once per machine)
ADDRPYLE SEQNBR(1500) MSGID(CPA32B2) RPY('I')
This is done in "green screen". This sets a deafult answer ('I') on CPA32B2 inquiry message. The CPA32B2 is an internal massage id, which is tied to an drop column operation.
(It actually doesn't have to be done in "green screen", use it like CHGJOB command. Example :
cl: ADDRPYLE SEQNBR(1500) MSGID(CPA32B2) RPY('I');
)
Now you can start "Run SQL scripts", the first command to run is:
cl: CHGJOB INQMSGRPY(*SYSRPYL);
this changes the current job parameter INQMSGRPY, to *SYSRPYL. *SYSRPYL causes to look if exists a system reply parameter when an inquiry message should be displayed.
Now you can run your alter which drops the column.
Unfortunately, I don't know how to drop a column, just using JDBC. If someone knows please let me know.
References:
Understanding What Controls the Automatic Reply Function
Replying to Run-Time Inquiry Messages
Error in dropping column (forum post)
How can I avoid SQL0952 on ALTER TABLE?
Finally I found a solution:
CALL QSYS2.QCMDEXC('ADDRPYLE SEQNBR(1500) MSGID(CPA32B2) RPY(''I'')');
CALL QSYS2.QCMDEXC('CHGJOB INQMSGRPY(*SYSRPYL)');
ALTER TABLE <tablename> DROP COLUMN <column_name>;
There isn't enough information in your error message to be sure, but dropping a primary key column is generally quite risky and the database correctly makes it difficult.
You likely have a foreign key constraint involving that column.
Don't drop the constraint and delete that column unless you're sure you know what you're doing.
According to this post: http://bytes.com/topic/db2/answers/185467-drop-column-table
It is possible to drop a column using STRSQL in the green screen environment. I have access to this and it does work, but a client with a 400 does not have the licensed program to use STRSQL. The issue is that STRSQL will prompt if this is something I really want to do.
To get at the data I'm using SQuirrel SQL client with the JT400 JDBC driver... So I guess with the system insisting on prompting (and actually no way of getting the prompt even without STRSQL) it won't let me do it.
So I guess I'm stuck doing what I'm doing... creating a new table and copying the data and then swapping the tables.
The only way I found to get jdbc to work is to first manually change the default for this message. Then run your update application. In our case we use Liquibase. I could get the java's CommandCall to call ADDRPYLE and CHGJOB INQMSGRPY(*SYSRPYL), but it never actually allowed the alter table * drop column * to not give the follow error:
Error:
10 -- A cancel reply to an inquiry message was received.
Working Command:
CHGMSGD MSGID(CPA32B2) MSGF(QSYS/QCPFMSG) DFT('I')
Reference:
http://knowledgebase.progress.com/articles/Article/9678
green screen -- STRSQL will give you error msg to answer
alter table devlibsc/trklst drop column "ST"
Change of file TRKLST may cause data to be lost. (C I)

SQL0100W Error on DB2

I get the following error when running an sqr report on DB2:
SQL0100W - No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table. SQLSTATE=02000
The sql in question runs correctly when I paste it into RapidSQL, replacing the parameters. The sql in question is an insert-select. No rows are returned by the select, and this is fine... I expect the report to be blank for my parameters.
Any idea how I can get around this?
DB2 returns always an SQL0100 warning (this is a warning, not an error - errors would have negative values) when no rows are returned. That's the way it is.
I don't know peoplesoft at all - so I can't give you any pointers with that. Back when I was programming for DB2 we ignored those SQL0100 warnings.
If SQR can't gracefully handle a NOT_FOUND SQL0100 return, then code a preliminary query to return a count of the number of rows that satisfy the conditions of the actual query. Check the result of the count in an if-then block in SQR to run the actual query if and only if the row count returned by the preceding query was not zero.
Turns out to be an environment setup issue. Got resolved with no change from me after a couple of builds....
Strange :-/
if you delete delete more than one record using logic operation like delete from tabname where columnnmae=deleterecord and columnnmae=deleterecord then they show this type error.machine an