Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

How to "Date" help

$
0
0
I am looking to write a SQL query and use a dynamic date. I want the SQL to ALWAYS use 1/1 to 12/31 of the prior calendar year. So, if it is run at any point in 2016, it will return all results from 1/1/15 to 12/31/15. If I run it in 2017, the dates will automatically change to 1/1/16 to 12/31/2016. Is this possible?

Viewing all articles
Browse latest Browse all 3145

Trending Articles