Hi all,
I am try to get the fiscal year based on the current date. I have specified my current fiscal month.
[u]
Part One</u>
1-If the current month >= 10 add 1 year as nextyear
2-If the current month <= 10 subtract 1 year lastYear
[u]
Part two</u>
When the #1 statement is true then the results set should be
"This year" -"NextYear" =last 2 digits are a string
When the #2 statement is true then the results set should be
"This year" -"LastYear" =last 2 digits are a string
any help will be greatly appreciated. Getting the results from part one is most important to me. Here is what I have so far
create PROCEDURE dbo.FiscalYear AS
Set NOCOUNT On
declare @MonDate char(5),@begMonth char(2),@year char(4)
select @begMonth=datepart(yy,getdate())
set @begMonth = isNull(@begMonth,1)
if len(rtrim(@begMonth)) = 1
begin
set @begMonth = '10' + rtrim(@begMonth)
end
if @begmonth >='10'
set @Year= datepart(yy,getdate()+1)
if @begmonth <'10'
set @year = datepart(yy,getdate()-1)
set @MonDate = @begMonth --+ '-01'
select @MonDate as FiscalMonth,@year as FiscalYear
Jaime E. Maccou
Applications Analyst
mailto:
[email protected]
"Our lives begin to end the day we become silent about things that matter."
- Dr. Martin Luther King, Jr.
"The mind does not take its complexion from the skin..."
- Frederick Douglass
There is always a way to do it better . . . find it!" Thomas A. Edison