What I am trying to do seems simple and I have most of it figured out. I am
in RS2000, using Oracle DB. I am getting the the CreatedMonth and
CurrReportMonth...no issues. I need help with deriving PrevReportMonth
because it crosses years. In this example that the CreatedMonth = 200802
If there is a better way to do this maybe in T-SQL I am definitely open to
that also.
select to_number(to_char(sysdate, 'YYYYMM')) as CreatedMonth,
to_number(to_char(sysdate, 'YYYYMM') - 1) as CurrReportMonth,
'200712' as PrevReportMonth
from dual
Thnx in advance
OSWhy dont you try using the add_months() dunction. it will solve the
cross year problem it self. But the datatype have to be date.
On Mar 8, 4:40 am, OriginalStealth
<OriginalStea...@.discussions.microsoft.com> wrote:
> What I am trying to do seems simple and I have most of it figured out. I am
> in RS2000, using Oracle DB. I am getting the the CreatedMonth and
> CurrReportMonth...no issues. I need help with deriving PrevReportMonth
> because it crosses years. In this example that the CreatedMonth = 200802
> If there is a better way to do this maybe in T-SQL I am definitely open to
> that also.
> select to_number(to_char(sysdate, 'YYYYMM')) as CreatedMonth,
> to_number(to_char(sysdate, 'YYYYMM') - 1) as CurrReportMonth,
> '200712' as PrevReportMonth
> from dual
> Thnx in advance
> OS
Tuesday, March 20, 2012
Parameters: Calculating Months
Labels:
calculating,
createdmonth,
database,
figured,
microsoft,
mysql,
oracle,
parameters,
rs2000,
server,
sql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment