• Another point - it would be worth setting the date selection parameters outside the select statement like so:

    DECLARE @DateParam DateTime;

    select @DateParam = CONVERT(datetime,ltrim(CONVERT(char(30),DATEADD(d,-1,getdate()),101))+ '02:00:01 AM');

    -- Also: It might be tidier to use Varchar(30) instead of Char(30) & put a space in front of the time:

    select ltrim(CONVERT(varchar(30),DATEADD(d,-1,getdate()),101))+ ' 02:00:01 AM'

    Using functions in the where clause disables the use of indexes & can slow queries down

    This would give you:

    WHERE dbo.BVActions.orderedTime

    BETWEEN @DateParam1

    AND @DateParam2