3 added 771 characters in body
source | link

Why don't you declare two variables (@Today and @Tomorrow) and select where date_shipped >= @Today and date_shipped < @Tomorrow

DECLARE @Today DATETIME
DECLARE @Tomorrow DATETIME

SET @Today = dateadd(dd, datediff(dd, 0, getdate()), 0)
SET @Tomorrow = dateadd(dd, datediff(dd, 0, getdate()) +1, 0)

PRINT @Today
PRINT @Tomorrow

So - after declaring your variables for @Today and @Tomorrow and setting their values accordingly, your WHERE clause would be something like this

WHERE  O.date_shipped >= @Today and O.date_shipped < @Tomorrow

Assuming you want to put this logic in a stored procedure and have a particular DateTime value passed in (instead of always using GETDATE()), you could create something like this:

CREATE PROCEDURE GetShippingInformation (@DateShipped DATETIME)
AS
BEGIN
    DECLARE @DateShippedBegin DATETIME
    DECLARE @DateShippedEnd DATETIME

    SET @DateShippedBegin = dateadd(dd, datediff(dd, 0, @DateShipped), 0)
    SET @DateShippedEnd = dateadd(dd, datediff(dd, 0, @DateShipped) + 1, 0)

    PRINT 'You are searching between ' + convert(varchar(20),@DateShippedBegin) + ' and ' + convert(varchar(20),@DateShippedEnd)
END
go
exec GetShippingInformation '2017-01-01'
GO
exec GetShippingInformation '2017-06-01'
GO

Why don't you declare two variables (@Today and @Tomorrow) and select where date_shipped >= @Today and date_shipped < @Tomorrow

DECLARE @Today DATETIME
DECLARE @Tomorrow DATETIME

SET @Today = dateadd(dd, datediff(dd, 0, getdate()), 0)
SET @Tomorrow = dateadd(dd, datediff(dd, 0, getdate()) +1, 0)

PRINT @Today
PRINT @Tomorrow

So - after declaring your variables for @Today and @Tomorrow and setting their values accordingly, your WHERE clause would be something like this

WHERE  O.date_shipped >= @Today and O.date_shipped < @Tomorrow

Why don't you declare two variables (@Today and @Tomorrow) and select where date_shipped >= @Today and date_shipped < @Tomorrow

DECLARE @Today DATETIME
DECLARE @Tomorrow DATETIME

SET @Today = dateadd(dd, datediff(dd, 0, getdate()), 0)
SET @Tomorrow = dateadd(dd, datediff(dd, 0, getdate()) +1, 0)

PRINT @Today
PRINT @Tomorrow

So - after declaring your variables for @Today and @Tomorrow and setting their values accordingly, your WHERE clause would be something like this

WHERE  O.date_shipped >= @Today and O.date_shipped < @Tomorrow

Assuming you want to put this logic in a stored procedure and have a particular DateTime value passed in (instead of always using GETDATE()), you could create something like this:

CREATE PROCEDURE GetShippingInformation (@DateShipped DATETIME)
AS
BEGIN
    DECLARE @DateShippedBegin DATETIME
    DECLARE @DateShippedEnd DATETIME

    SET @DateShippedBegin = dateadd(dd, datediff(dd, 0, @DateShipped), 0)
    SET @DateShippedEnd = dateadd(dd, datediff(dd, 0, @DateShipped) + 1, 0)

    PRINT 'You are searching between ' + convert(varchar(20),@DateShippedBegin) + ' and ' + convert(varchar(20),@DateShippedEnd)
END
go
exec GetShippingInformation '2017-01-01'
GO
exec GetShippingInformation '2017-06-01'
GO
2 added 221 characters in body
source | link

Why don't you declare two variables (@Today and @Tomorrow) and select where date_shipped >= @Today and date_shipped < @Tomorrow

DECLARE @Today DATETIME
DECLARE @Tomorrow DATETIME

SET @Today = dateadd(dd, datediff(dd, 0, getdate()), 0)
SET @Tomorrow = dateadd(dd, datediff(dd, 0, getdate()) +1, 0)

PRINT @Today
PRINT @Tomorrow

So - after declaring your variables for @Today and @Tomorrow and setting their values accordingly, your WHERE clause would be something like this

WHERE  O.date_shipped >= @Today and O.date_shipped < @Tomorrow

Why don't you declare two variables (@Today and @Tomorrow) and select where date_shipped >= @Today and date_shipped < @Tomorrow

DECLARE @Today DATETIME
DECLARE @Tomorrow DATETIME

SET @Today = dateadd(dd, datediff(dd, 0, getdate()), 0)
SET @Tomorrow = dateadd(dd, datediff(dd, 0, getdate()) +1, 0)

PRINT @Today
PRINT @Tomorrow

Why don't you declare two variables (@Today and @Tomorrow) and select where date_shipped >= @Today and date_shipped < @Tomorrow

DECLARE @Today DATETIME
DECLARE @Tomorrow DATETIME

SET @Today = dateadd(dd, datediff(dd, 0, getdate()), 0)
SET @Tomorrow = dateadd(dd, datediff(dd, 0, getdate()) +1, 0)

PRINT @Today
PRINT @Tomorrow

So - after declaring your variables for @Today and @Tomorrow and setting their values accordingly, your WHERE clause would be something like this

WHERE  O.date_shipped >= @Today and O.date_shipped < @Tomorrow
1
source | link

Why don't you declare two variables (@Today and @Tomorrow) and select where date_shipped >= @Today and date_shipped < @Tomorrow

DECLARE @Today DATETIME
DECLARE @Tomorrow DATETIME

SET @Today = dateadd(dd, datediff(dd, 0, getdate()), 0)
SET @Tomorrow = dateadd(dd, datediff(dd, 0, getdate()) +1, 0)

PRINT @Today
PRINT @Tomorrow