Below qry can be executed in sql server .. how to write in DB2 ?? does it need dummy tables??? without that anyway to write ????
SELECT COUNT(*)
FROM
(
SELECT 1 AS d
UNION ALL SELECT 2
UNION ALL SELECT 3
UNION ALL SELECT 4
UNION ALL SELECT 5
UNION ALL SELECT 6
UNION ALL SELECT 7
) weekdays
=======================
Acutal qry need to be converted in db2 ... for business days
------------------------------------------------------------
select (DATEDIFF(DAY, '2008/11/01', '2009/12/30')+1) / 7 * 5
+
( (DATEDIFF(DAY, '2008/11/01', '2008/12/30')+1) % 7 )
-
(
SELECT COUNT(*)
FROM
(
SELECT 1 AS d
UNION ALL SELECT 2
UNION ALL SELECT 3
UNION ALL SELECT 4
UNION ALL SELECT 5
UNION ALL SELECT 6
UNION ALL SELECT 7
) weekdays
WHERE d <= ( (DATEDIFF(DAY, '2008/11/01', '2008/12/30')+1) % 7 ) % 7
AND DATENAME(WEEKDAY, day('2008/12/30') - d + 1)
IN
(
'Saturday',
'Sunday'
)
)