[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: How do I know What Qtr of Year it is !
- Subject: Re: How do I know What Qtr of Year it is !
- From: "Dray, Adam" <Adam.Dray@PHH.COM>
- Date: Thu, 8 Apr 1999 13:57:24 -0400
Without going into all the details, let me talk about one trick you
can use:
Set up two strings:
Let $months = '010203040506070809101112'
Let $month_map = '101010010101040404070707'
In your SQL use a charindex or substr or whatever to determine the
position of the month (01, 02, ..., 12) in $months.
Use that index to grab a 2-character substring out of $month_map.
Those two characters are the starting month for the quarter on which
you need to report.
/ad/
> -----Original Message-----
> From: Dominick LoGiudice [SMTP:dlogiudice@PINE.VPCC.SUNYSB.EDU]
> Sent: Thursday, April 08, 1999 2:32 PM
> To: Multiple recipients of list SQR-USERS
> Subject: How do I know What Qtr of Year it is !
>
> I am writing an sqr that needs to look for qtr data. Example if
> I ran today the run date I have is formatted like this 19990408. I can
> substr out
> the month as 04. Using 04 I need to look on a table if the date is '01'
> or '02' or
> '03'. Based on the run date the qtrs I need to look for will always
> change. I next
> run this sqr in July so my qtr rundate will be 07 so I need to look for
> '04' , '05' or
> '06'. Is there a delivered sqr to do this.
> I guess the short story is I need to know what 3 months are the previous
> qtr.
> thanks