Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you use date variables in DB2 SQL code?

Status
Not open for further replies.

ToyFox

Programmer
Jan 24, 2009
161
US
I am trying to get a DB2 pass thru query to work. I intend to pass two dates to a function and build a pass thru that utilizes the dates. However, how do I substitute
the date values for the hard coded values in the following SQL.... thanks ... the following code works until I start playing with the date values!!!.


SELECT OPEN_DT, ACCOUNT_NO, BRANCH_NO FROM TB
WHERE OPEN_DT >= '11/1/2009' AND OPEN_DT <= '11/30/2009' GROUP BY OPEN_DT, ACCOUNT_NO, BRANCH_NO HAVING BRANCH
 
Where did the term "pass thru query" originate. . .?

Why not put the dates into host variables rather than literals if you want them to be dynamic?
 
Toyfox,
Are you talking an MS Access front end connected to a DB2 database?

I'm guessing that you are as that's the only place I've come across the term 'passthru query' before.

If so, how are you building the SQL? VBA?

Marc
 



Did you try CURRENT DATE???

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top