Calculate fiscal year in SQL Server

前端 未结 19 1532
时光说笑
时光说笑 2020-12-16 13:28

How would you calculate the fiscal year from a date field in a view in SQL Server?

19条回答
  •  余生分开走
    2020-12-16 13:57

    I don't think you can, because there is no universal fiscal calendar. Fiscal years vary between businesses and countries.

    ADDENDUM: What you would need to do is have a separate DB table consisting of a fiscal start date, and a fiscal end date for each applicable year. Use the data in that table to calculate the fiscal year given a particular date.

提交回复
热议问题