Select records between different work shifts depending on datetime I have a data table called "Requests" that records the requests made by employees in a company, I used to use a Stored Procedure to get all the request from a single workday (starting at 6am and ending at 6am of the next day)

USE [DataBase]
GO
/****** Object:  StoredProcedure [dbo].[GetRequests]  ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[GetRequests]
as begin
DECLARE @from datetime 
set @from = getdate();
if (DATEPART(HOUR, @from) &lt; 6) set @from = dateadd(day, -1, @from);

DECLARE @start_date datetime = CONVERT(datetime, CONVERT(char(9), @from, 112) + '06:00');
DECLARE @end_date datetime = DATEADD(HOUR, 24, @start_date)

select * FROM Requests
where RequestDate between  @start_date and @end_date
end


Now I need another stored procedure to get all the request from a specific work shift.

The company has 3 work shifts (1st: 6am to 2pm / 2nd: 2pm to 10pm / 3rd: 10pm to 6am).

Is there a way to get all the requests from a single shift?

For example: if the current time is 5am, to only show the requests from the 3rd shift (10pm to 6am) and if it is 3pm to only show the requests from the 2nd shift (2pm to 10pm)
I feel like this is harder than it needs to be. I like to imagine that in your dataset you have a datetime column that is stored when each request is submitted. If that is the case I think you would have a much better time writing a proc that filters that column. 

However, I used your proc and just branched off. I didn't test this since i'm not sure what your dataset looks like but I think you may be looking for something along the lines of this 

create procedure [dbo].[GetRequests]
as begin
DECLARE @from datetime 
set @from = getdate();
if (DATEPART(HOUR, @from) &lt; 6) set @from = dateadd(day, -1, @from);

DECLARE @start_date datetime = CONVERT(datetime, CONVERT(char(9), @from, 112) +     '06:00');
DECLARE @end_date datetime = DATEADD(HOUR, 24, @start_date)
declare @fshift datetime = dateadd(hh, 8, @start_date)
declare @tshift datetime = dateadd(hh, 8, @fshift)
declare @trshift datetime = dateadd(hh, 8, @tshift)
declare @night datetime = dateadd(hh, 8, trshift)

select * 
FROM Requests
where RequestDate in (select * 
                      FROM Requests
                      where RequestDate between  @start_date and @end_date) 
    and RequestDate between  @fshift and @tshift
    and requestdate between @tshift and @trshift
    and requestdate between @trshift and @night
end