How to Find Current Financial Year using SQL Query

Write the following SQL Snippet in Query Editor.

  1. DECLARE @Year VARCHAR(20)  
  2.   
  3. SELECT @Year =(CASEWHEN (MONTH(GETDATE()))<= 3 THENconvert(varchar(4),YEAR(GETDATE())-1)  
  4. +'-'+convert(varchar(4),YEAR(GETDATE())%100)  
  5. ELSEconvert(varchar(4),YEAR(GETDATE()))  
  6. +'-'+convert(varchar(4),(YEAR(GETDATE())%100)+1)END)  
  7.   
  8. SELECT @Year ASCurrentFinancialYear 
Execute the preceding script and check the output,

OUTPUT

We can see the current financial year using the preceding query.

 

Ebook Download
View all
Learn
View all