How would you calculate the fiscal year from a date field in a view in SQL Server?
相关问题
- sql execution latency when assign to a variable
- What is the best way to cache a table from a (SQL)
- php PDO::FETCH_ASSOC doesnt detect select after ba
- Bulk update SQL Server C#
- SQL to Parse a Key-Value String
相关文章
- Entity Framework 4.3.1 failing to create (/open) a
- Code for inserting data into SQL Server database u
- Delete Every Alternate Row in SQL
- Linux based PHP install connecting to MsSQL Server
- SQL Azure Reset autoincrement
- How do we alias a Sql Server instance name used in
- Is recursion good in SQL Server?
- How can I convert a OLE Automation Date value to a
Given
@FiscalYearStartMonth
is your fiscal year start month (numeric) and@Date
is the date in question, do the following:You can abstact this away in a function, or use as a column in a derived view
I suggest you use a User-Defined Function based on the Fiscal year of your application.
Use it like this:
Here is Australian Financial year start date code
It returns like
'2012-07-01 00:00:00.000'