I have a query that uses a year and the quarter as parameters. I having trouble finding any meaningful help on line to do this. I have a timestamp from the table that I want to use. It's an end date. If the end date is within the beginning and ending quarter selected or is null or after the ending quarter then I want that person. The persons start date needs to be before or during the selected quarters.
They select a year, beginning quarter and ending quarter.
I'm going to be using this in an SSRS report. I can attach the code if needed.
<Not to change the closing of the question, but some added info>
If you're going to go the calendar table route, here's another article with ready-made T-SQL on how to build your own table, and please click the 'Good Article' button if it helped you.
This article has separate columns for calendar_year and calendar_quarter. I've seen a few places that will create a view that has the combined year-quarter as in int value (e.g. 201504, 201601, 201602, ...) and then a text value (4th Quarter 2015, 1st Quarter 2016, 2nd Quarter 2017, etc.) Then in the combo box that is displayed to the user only display the text, but make the int the bound value that is passed to the data source.
Good luck.
Sherry
ASKER
Although we don't have my data in the data warehouse as yet, Brian solution is the best and that's the way to go when I get it there. I found something that will work for now.
If you're going to go the calendar table route, here's another article with ready-made T-SQL on how to build your own table, and please click the 'Good Article' button if it helped you.
This article has separate columns for calendar_year and calendar_quarter. I've seen a few places that will create a view that has the combined year-quarter as in int value (e.g. 201504, 201601, 201602, ...) and then a text value (4th Quarter 2015, 1st Quarter 2016, 2nd Quarter 2017, etc.) Then in the combo box that is displayed to the user only display the text, but make the int the bound value that is passed to the data source.
Good luck.