Is ASA query language support Declare Variable and loop? RRS feed

  • Question

  • Now we want to declare a variable like SQL and do a loop in the query, we try it like in the SQL:

    Declare @test varchar(500)

    Declare cur Cursor For Select [name] From Items where type = 'int'

    Open cur

    Fetch Next From cur Into @test

    While @@fetch_status = 0

    Begin ...

    Seems it does not support it, so how to achieve it?

    Monday, June 13, 2016 9:52 AM

All replies

  • I would like to understand your scenario.
    What are you trying to achieve with your query that leads you to trying a cursor?
    Monday, June 27, 2016 7:48 PM
  • Do you still require assistance here?
    Friday, July 29, 2016 10:27 PM
  • Hi,

    I want to declare some variables & formulas in my ASA query and use it on the stream of timeseries data to gt the desired output stream result . 

    For example, i am getting current value & timestamp from a device sensor. I nominate a value at morning 9.00 AM which my device will achieve in day time(8hours). Now iwant to see variance and total accumulated data value at particular time.

    How can i achieve it using stream analytics.


    Sudhir Jain

    Tuesday, August 30, 2016 9:19 AM
  • Just to make sure I understand ...

    You have some reference data (your nominated values) which you refresh periodically.
    You then want to determine variance and total accumulated values every 8 hrs? '

    Is this correct?

    Tuesday, August 30, 2016 10:35 PM