Skip to content Skip to sidebar Skip to footer
Showing posts with the label Db2

How To Put A Constraint On Two Combined Fields?

I'd like to put a constraint, a check or a foreign key, on two combined fields from table1 to a… Read more How To Put A Constraint On Two Combined Fields?

Db2 Equivalent Of Sql Server's Trigger_nestlevel()?

I'm trying to get control of a recursive trigger over DB2 (v9.7), unfortunately IBM documentati… Read more Db2 Equivalent Of Sql Server's Trigger_nestlevel()?

Db2 Luw 10.5 - How To Force Db2 Stored Procedures To Use Latest Stats For Most Optimized Plan

We see an issue occasionally. Stored procedure running a SQL runs very slow. Same SQL when run fro… Read more Db2 Luw 10.5 - How To Force Db2 Stored Procedures To Use Latest Stats For Most Optimized Plan

Calculating How Many Days Are Between Two Dates In Db2?

I need to get the difference in days between two dates in DB2. I tried a couple of different querie… Read more Calculating How Many Days Are Between Two Dates In Db2?

Is There Any Better Way To Write This Query

I designed below query for my delete operation. I am new to SQL and just wanted to check with exper… Read more Is There Any Better Way To Write This Query

Db2 Coalesce Function Is Returning Nulls

I am using DB2 for IBM i V6R1, and I am trying to convert a string value which sometimes has a vali… Read more Db2 Coalesce Function Is Returning Nulls

Decimal Formatting In Sql Query

I have a query as below: Select price from myTable; This returns value '22.50' However, I … Read more Decimal Formatting In Sql Query

Why Does My Query Generate An "undefined Name" Error With Sqlcode -204?

This is a SQL Server query select Letter, COUNT(*) from #Letters LEFT JOIN Emp ON Name LIKE Letter … Read more Why Does My Query Generate An "undefined Name" Error With Sqlcode -204?

Db2 Sql Function With Dynamic Return Value

I have the following working DB2 SQL function CREATE OR REPLACE FUNCTION selector (param VARCHAR(3… Read more Db2 Sql Function With Dynamic Return Value

How To Get Rows For N Distinct Values Of A Column

I need to get rows for n distinct invoice numbers. I have SELECT query that gives me results from t… Read more How To Get Rows For N Distinct Values Of A Column

Sql - Why Pad Spaces When Comparing Characters?

Seems like DB2 and Oracle implement character comparison by padding the shorter string with spaces … Read more Sql - Why Pad Spaces When Comparing Characters?

Db2 Sql Update Correlating With Subquery

Code block: update yrb_purchase px set px.club = (select club from (select p.… Read more Db2 Sql Update Correlating With Subquery

Create A Delimitted String From A Query In Db2

I am trying to create a delimitted string from the results of a query in DB2 on the iSeries (AS/400… Read more Create A Delimitted String From A Query In Db2

Db2 Size Of Table

I'm trying to figure out the size in kb of each table in a schema. I have a query set up, but I… Read more Db2 Size Of Table

Function With Different Returns Db2

Hi I have this function: CREATE or replace FUNCTION Tablereturn (SWITCHER INTEGER) RETURNS TABLE … Read more Function With Different Returns Db2

Cognos 11.1.7 Framework Manager Change The Table For The Query Subject, Type Data

Using Cognos 11.1.7 and the database is DB2 on IBMi DQM Trying to figure out how to get Framework m… Read more Cognos 11.1.7 Framework Manager Change The Table For The Query Subject, Type Data

Drop A Db2 View If It Exists

Why doesn't this work in IBM Data Studio (Eclipse): IF EXISTS (SELECT 1 FROM SYSIBM.SYSVIEWS WH… Read more Drop A Db2 View If It Exists

Sql Query Where Mydate Should Be Less Than 2 Years From The Current Date

I have one date column MyDate and I want those records in which MyDate should be less than current … Read more Sql Query Where Mydate Should Be Less Than 2 Years From The Current Date

Db2 Before Trigger Syntax

I've defined this trigger: CREATE TRIGGER actualizarSaldoIngreso BEFORE INSERT ON Ingreso FOR E… Read more Db2 Before Trigger Syntax

How To Delete All Non-numerical Letters In Db2

I have some data in DATA column (varchar) that looks like this: Nowshak 7,485 m Maja e Korabit (Gol… Read more How To Delete All Non-numerical Letters In Db2