本文介绍了返回财政年度的第一天(4月1日)T-SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
财政年度的第一天是4月1日.
First Day of financial year is April 1st.
T-SQL查询将在4月1日返回 getdate()
T-SQL Query to return April 1st for the getdate()
财政年度:4月1日至3月31日
Financial Year: April 1st to March 31st
推荐答案
尝试一下:
select DATEFROMPARTS(Yr, 4, 1) [start], DATEFROMPARTS(Yr + 1, 3, 31) [end] from
(select case when DATEPART(month, getdate()) < 4 then DATEPART(year, getdate()) - 1 else DATEPART(year, getdate()) end Yr) a
这篇关于返回财政年度的第一天(4月1日)T-SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!