• chef423 - Tuesday, December 19, 2017 12:01 PM

    select *
    from TicketItem
    where s_item IN('Coffee', 'Espresso', 'Double Espresso', 'Decaf Espresso', 'Cappucino', 'Latte', 'Iced Coffee', 'sm coffee pot', 'lg coffee pot')
    and dt_when >= dateadd(Quarter, datediff(quarter, 0, getdate()), 0)
    and hour(dt_when) = 7

    This query chokes on the 'hour' giving:
    Msg 195, Level 15, State 10, Line 15
    'hour' is not a recognized built-in function name.

    Because it isn't, use datepart, for example: DATEPART(HOUR,GETDATE())