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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Code Help Please

Status
Not open for further replies.

gtb12314

Programmer
Jan 7, 2008
41
US
Hi there,

Please help me out, I want to know what will be the code in oracle 9i for the following line of code, I tried several ways but not yet solved.

I mean I want to transform the following code into oracle 9i SQL.

dateadd('yyyy',-1,(date(year(datadate)-1,month(datadate),1)))

Any suggestion.

Thanks in advance

 
I'm with Jim - can you explain a little more, please. Do I understand correctly that this is SQL Server code in the original?

I want to be good, is that not enough?
 
Do I understand correctly that this is SQL Server code in the original?
I'm pretty sure that it is Crystal Reports. And if I remember correctly datadate supplies the date that a report was last refreshed. The logic of the expression seems a bit weird, i.e. it looks to me like the expression is trying to return a date 2 years prior to datadate on the first of the month of datadate e.g. an argument of today's date (3rd March 2008)would return 1st March 2006. :

DateAdd ('yyyy',-1, adatevalue) would subtract 1 year from the given date.
year(adatevalue)-1 take the year of the given date and subtract 1
month(adatevalue) Take the month of the supplied date
date(year(adatevalue)-1,month(adatevalue),1) return the 1st day of the month for the supplied date's month, 1 year prior to this year.
Now, the OP has posted this on a few sites and has notreplied to anyone looking for more info so far. So until he replies here with details of exactly what his expression is meant to do, I'm going to leave well alone.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top