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!

date parameter in an SQL command

Status
Not open for further replies.

mikiap

MIS
Nov 27, 2003
27
CH
Hi

I have created a report in CR9 based on a Command. The command looks like this:

SELECT A.SITE_NAME, A.CUSTOMER_ID, A.CUSTOMER_NAME, A.START_DATE, A.RECORD_FROM, A.OUTAGE_TYPE
FROM IML.TAMSSLA2 a
WHERE A.START_DATE>=date(year({?datum})-01-01) And A.START_DATE<={?datum}
The command has a parameter = datum
The command seems to work but the results are not the expected ones. If I input the date=11/12/2004 when I run the report it should display the data between 01/01/2004 and 11/12/2004 but in reality it takes also the data from the previous years. From here I conclude the formula
date(year({?datum})-01-01) is not a correct one. Any idea which is the right way to write it?

Thanks a lot
Miki
 
I forgot to say that the report is using a DB2 database.
Thanks
 
Change the data formula to this

WHERE A.START_DATE>=date(year({?datum})-1,1,1) And A.START_DATE<={?datum}

Cheers,

-LW
 
I tried already the sintax A.START_DATE>=date(year({?datum}),1,1) and it says "the number of the parameters for the functions is incorrect".

Miki
 
Do separate formula fields for your start date and end date. Display them on the report. See what you actually get from your formulas - always the best way to correct them.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top