?
Solved

DB2 date function for Thurs, Fri, Sat of every week

Posted on 2013-01-22
3
Medium Priority
?
507 Views
Last Modified: 2013-01-31
I'm creating a dynamic report. I need a date function for items that may expire on Thurs or Fri or Sat of every week that the report is run.
How do would I write such a date function?

Thank you.
0
Comment
Question by:saved4use
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 37

Expert Comment

by:momi_sabag
ID: 38808107
what exactly do you want the function to do? it is not clear from your description
0
 

Author Comment

by:saved4use
ID: 38808150
Reflect items that expire on Thurs, or Fri or Sat of every week. *I need a DB2 date function, for example, 'CURRENT _DATE + 3 days'
0
 
LVL 45

Accepted Solution

by:
Kent Olsen earned 1000 total points
ID: 38808313
Hi Saved,

That's somewhat ambiguous, but with just a bit more information the query is easy to write.

SELECT *
FROM {mytable}
WHERE dayofweek (expiration_date > 4)               -- select only thurday, friday, saturday
  AND current_date + 6 days <= expiration_date   -- and within the next 7 days
  AND expiration_date >= current_date                  -- and in the future (or today)

That's a pretty good start.  It's easy to adjust as you need it.


Good Luck,
Kent
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question