Skip to content
Advertisement

Tag: ibm-midrange

How to use result of SELECT in a limit

I have a table here that keeps repeating results over environments. Cf : … etc etc. I tried to use a group by but as there are slight changes in the encoding, it’s not really effective. I tried to specify an environment too but from a machine to another, it changes. But I do have a Column named ” Ordinal_Position

pyodbc is returning binary data in char field

pyodbc with driver “iSeries Access ODBC Driver” is returning binary output, Ex: original data in the table: B06300 what it returns: b’xc2xf0xf6xf3xf0xf0@@@@@@@@@@@@@@@@@@@@@@@@’ My code: I tried putting add_output_converter and encoder to connection but didn’t work Answer I suspect the problem is that the data is defined on the server as CCSID 65535, which means to not translate the data. Using

Column or global variable not found db2

I have a issue with DB2. I have two libraries with the same structure database. The only one difference is the data. When i try this sql request for the first library, it’s work but when i try with the other library, i have this error. I check the CLIENT and EMPLOYE tables and they have the column with data.

Having weird exception using MAX(CASE WHEN) in query: DB2.iSeries.iDB2DCFunctionErrorException: ‘An unexpected exception occurred

I have the following query to put some data from rows in columns: But when I try to run it in the following code: I get this exception: “IBM.Data.DB2.iSeries.iDB2DCFunctionErrorException: ‘An unexpected exception occurred. Type: System.AccessViolationException, Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt..'” I have other queries that work just

Using subquery with update SQL

I have Table 1 : EMP as below Table 2: EMP1 ID is the Key and is common in both the files. I want an Update SQL to update the amount field of Table 1 using Amount field of table 2, which gives the result as below. Result: Answer One method is a correlated subquery: You can check if the

Keyword IF not expected

I have the following inline SQL code, running on an AS400. The IF comes up as unexpected but I don’t understand why. What I’m trying to do is to build a stored procedure to update, or insert, a …

MAX Date for each row

I am having some difficulty at writing a syntax that will provide me with the most recent date for several results. Little bit of background, I am pulling live data from an IBM AS400, I have no SQL tables, I am connecting to the tables via ODBC, using QTODBC to create my queries, then I export them to Power Bi.

Advertisement