StackOverflow is a collaborative programming Q&A community venture
Note: The content of this blog is the opinion and thoughts of the blogger and does not necessarily represent the opinions of IDUG.
Exclude records in AVG SQL function? (can't use WHERE in main query because of another count)
my SQL query which works fine is
I want to get for each month number of services with ADSL (it is done through the first COUNT)and average time difference in hours for the records which do not have service ADSL. So I must exclude in the AVG function all records with service ADSL but I can not put it in where clause
because my COUNT function needs to have service='ADSL'
How to solve this?
What is the syntax problem here using this subquery inside where clause
Incorrect syntax near ')'. Expecting AS, FOR_PATH, ID, or QUOTED_ID.
DB2 Dynamic query execution which returns row count
Here i am trying to run a dynamic query in DB2 which returns row count in a variable.
Could anyone help me out how to store the result of a dynamic query into a variable so that I could use it further? Below are code snippet:--
Getting below error:- ERROR  [IBM][DB2/AIX64] SQL0206N "CNT" is not valid in the context where it is used. SQLSTATE=42703
How to call User-define function with out schema name in dynamic query in DB2 Procedure
Without schema name its not able to call user defined function.
when i am trying to execute this procedure its working but if i am remove alias name from my function as highlighted so its unable to call user define function. pls help me out thanks in advance.
Mainframe job dependency in SQL Server job
I have a SQL Server job which has to check if the mainframe DB2 job is complete (for the data) and then run the SSIS packages. I plan to add step 1 to check if the job is complete. I cannot add the job name directly in stored procedure which is one of the ways we write two SQL jobs dependency. Is there any other way?
Unable to connect to DB2 via ODBC with DB2CLI.exe in Windows Docker container
I have a DB2 instance, and I'm trying to access it via a Windows Docker container using an ODBC connection. I installed the ODBC drivers and DSN using DB2CLI.exe, but when I go to validate
And it does not connect. No errors are thrown, and the log (
Dockerfile (where the DB2 ODBC drivers are unpacked into
Base Images: I've tried, without success, on Windows 10 1903, Windows Server Core LTSC 2019, and microsoft/iis
When I setup the DSN and drivers as above on Windows 10 and Windows Server 2016 (VMs or locally), and then run the
When I try to do the same in the ~mostly~ same environment but in Docker, it fails, even though the DSN appears to have been successfully created (
Is the ODBC driver not setup correctly in Docker, or is there some environmental issue with DB2CLI and Windows Docker containers? Without the
BinaryString posted from angular corrupted in node js blob file object after save in ibm db2 blob field
I'm using HTML 5 file reader to read the uploaded file and save it in a database as BLOB. And fetch this BLOB data and provide the download link in my application.
If I upload a PDF file and download, it works in my local machine. But same code not working in server, the downloaded PDF is empty
Code in angular to read the file and post the data to node.js
Code in node.js to save the data
Code n Angular to convert the BLOB data and download
In database the PDG file saved as BLOB(73630) 255044462D312E330A25C4E5.... if I try in local. In angular filesize shows 72 KB.
Same PDF file saved as BLOB(107262) 255044462D312E330A25C384... if I try in server. In angular filesize shows 105 KB.
Looks like the file corrupted while saving in the database. What could be the reason for this?
Db2 dynamic batch execution
Set ls_str='call batch_document(input1,input 2,?,?)';
How to execute tis dynamic query execution in db2.
I tried ,Prepare sql_statement from ls_str.
It not works.
How to override schema use on ibm_db.exec_immediate(connect, sql) in Python
I am trying to run a run
**Exception: [IBM][CLI Driver][DB2/LINUXZ64] SQL0204N "DatabaseUSer.ActualSchemaUser.TABLE_NAME" is an undefined name. SQLSTATE=42704 SQLCODE=-204**
It looks like
Is there a way I can prevent set or override the schema for ibm_db.exec_immediate() function.
Python code snippet:
Need an SQL script to update a new column with the values concatenated from 3 columns of the same table
I need a prepare an SQL script to be given to my production support team to run this in production. We have created a new column in the DB2 table. This column should be filled with the data by concatenating 3 column values of the same table in the same row.
To give a history, all the reason text which are entered in the front end are inserted into the request table by unstringing into 3 columns. Since they had limited length, we created a new column with increased length and going forward all insert will go into the new column. But we need to move all the existing data in the old 3 columns to his new one. S this SQL update is just an one time exercise.
We added new column to have a increased character length and to align with other table nomenclature. Now I need the script to update the column reasontext as below