azurestreamingazure-stream-analyticsstream-analytics

Restriction of sending events based on time In Stream Analytics Azure


In my Azure Stream Analytics Job, Want to restrict events sending to service bus queue after certain time of the day.

SA Query :

Select
    *
INTO
    servicebusqueue
FROM
    eventhub
Where name  = 'abc'
*AND Time < 1 PM*

How to write query for the "time < 1PM" ?


Solution

  • Using DATEPART should work (haven't tested this right now)

    Assuming Time is a field from your input data.

    Select
        *
    INTO
        servicebusqueue
    FROM
        eventhub
    Where name  = 'abc'
    AND DATEPART(hour, Time) < 13