12,947 questions
-3
votes
4
answers
228
views
Randomly selecting multiple rows from a table
I have this table in SQL:
CREATE TABLE mytable
(
id BIGINT,
color VARCHAR(10),
food VARCHAR(10),
sport VARCHAR(12),
animal VARCHAR(10)
) DISTRIBUTE ON (id);
INSERT INTO ...
0
votes
1
answer
154
views
How to dynamically generate column names based on month?
I have a table in a DB2 database; it looks like this:
customer_id
date
month
year
category
spend
111
2026-06-03
06
2026
A
10
111
2026-06-01
06
2026
A
15
111
2026-06-01
06
2026
B
20
111
2026-05-01
05
...
Advice
1
vote
2
replies
99
views
Join two tables to get partitioned sum of last 90 days
I have two tables; let's call them table_a and table_b. They look like this:
Table_a:
id | date
---|-----------
A | 2026-05-17
A | 2026-05-01
A | 2026-04-10
B | 2026-05-17
Table_b:
id | date ...
0
votes
1
answer
180
views
Error when I run SELECT queries to pull data from DB2 and write to SQL Server
I have a Python script that takes some SELECT queries and puts them on separate timers with threads, and each one queries periodically at set intervals. I have a SQL Express DB to store the tables I ...
0
votes
1
answer
160
views
Why is the current date being changed on the result set of cursor inside procedure?
I need help with an issue regarding date returns in a CURSOR in DB2 for LUW.
The Dt_Noformat field returns an incorrect date, while the Dt_Format field returns the date correctly.
This problem occurs ...
1
vote
2
answers
98
views
How to send big files with form-data via API Request QSYS2.HTTP_POST(_BLOB)_VERBOSE? 7.4
I have the task to upload a 150MB CSV File via an API Request.
https://direct.broadsign.com/api/v1/docs/#/Audience/post_api_v1_audience_csv
The postman CLI of it looks like this:
postman request POST '...
Best practices
0
votes
2
replies
95
views
DB2 LUW: is LAST_ACTIVITY alone reliable for stale-session cleanup when connection pooling is involved?
I’m evaluating whether LAST_ACTIVITY from MON_GET_CONNECTION is reliable enough to identify stale-session clean-up candidates in DB2 LUW, especially in environments where connection pooling may be ...
1
vote
1
answer
110
views
Combine multiple records into one
I have the following db2 table with data that looks like this:
KID_ID
F_NAME
L_NAME
TOY_NAME
HAS_IT
1
ABC
DEF
CAR
NO
1
ABC
DEF
BALL
NO
2
HIJ
LMN
CAR
YES
2
HIJ
LMN
BALL
NO
3
XYZ
123
CAR
NO
3
XYZ
123
...
0
votes
2
answers
104
views
IIDR CDC Kafka - EntraID / OAuth2
Can someone tell me if the IBM InfoSphere DataReplication for Kafka (CDC 2 Kafka) is capable to communicate to a Kafka cluster/broker that needs authentication via Microsoft EntraID / OAuth2 with ...
0
votes
1
answer
43
views
db2 generate unique value for each row returned by a SELECT query
I am trying to execute GENERATE_UNIQUE() against a DB2 view like this:
SELECT GENERATE_UNIQUE() AS record_id, myField
FROM myView;
But this returns the same value for each row.
So I tried:
SELECT ...
Best practices
0
votes
8
replies
119
views
How do I speed up df.write from Spark to IBM DB2
Currently I am fetching live data from Kafka (Which produces 45k rows per second) into Spark, convert those rows into a dataframe (as the data coming in from Kafka is in JSON format) and trying to ...
0
votes
0
answers
41
views
Set column length for DB2 UDF results
This was my first attempt at writing a UDF (I won't go into the reason because that would make it too long/complicated). The actual DB2 table has one column (amongst others) that contains a complete ...
1
vote
2
answers
196
views
How to use copybooks for COBOL programm using CICS and DB2?
I am learning COBOL, CICS, and DB2. To that end, I created a program that implements a pseudo-transactional CICS process and interacts with DB2. The transaction works quite well, but the program ...
0
votes
2
answers
126
views
How to split a string based on a delimiter that appears more than once? [duplicate]
I have a table in a DB2 database that contains some URLs - it looks like this:
ID | URL
---|-----------------------------------------------------------------------------
A | https://website-name.com/...
1
vote
1
answer
156
views
SQLAlchemy failing when querying an empty table in DB2
I have a table in my DB2 database with information about customer locations. Each location has a unique id (WLC = worklocation code).
I am trying to run a query in Python using SQLAlchemy to retrieve ...