how to write stored procedure calculate financial year compare current date using sql server 2008

Posted by Venky.Net under Sql Server on 11/26/2012 | Points: 10 | Views : 5094 | Status : [Member] | Replies : 1
hi
how to calculate financial year in current date
example
25-11-2012 this is my input
and display the financial year this format 2012-13.i want sql stored procedure or c# code with example.




Responses

Posted by: Krv on: 11/26/2012 [Member] Starter | Points: 25

Up
0
Down
Declare @curmonth int

Declare @curyear int
Declare @curfyyear varchar(25)

select @curyear =Datepart(yyyy,GETDATE()), @curmonth=Datepart(MM,GETDATE())

print @curmonth

if (@curmonth<=3)
SELECT @curyear = @curyear -1

SELECT @curfyyear = CAST(@curyear AS VARCHAR) + '-' + CAST(@curyear+1 AS VARCHAR)
PRINT @curfyyear


Thanks,
R.Vasanth
MCTS(SQL Server & BI)
http://bigdatatech.blogspot.com

Venky.Net, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response