this more experts question. need declare variable called billingyear can assign year. problem is:
i not know data type should be! know simple but... problem is, in our database not have year column. have called fiscal year starts 07/01/any year - , end 06/30/nextyear
i want find way enter year, year added fiscalstart, fiscalend variables datetime variables. tried not working!
declare @year int, --here thought can assign year year following: declare @fiscalstart datetime = '07/01/' + @year, @fiscalend datetime = '06/30/' + @year+1
then can use calculate billingmonth billingmonth = fn_fiscal(@fiscalstart, @fiscalend )// not need know part wanted show why need complicated steps. best way approach problem?
don't add int string , better use dmy order agnostic format such yyyymmdd
;
declare @year int = 2013 declare @fiscalstart datetime = cast(@year varchar(4)) + '0701'
Comments
Post a Comment