Search code examples
azureazure-stream-analytics

using split in azure stream analytics


I have strings in the format "1234.567.111". I wish to break it into three int.

I do not see a split function in azure stream analytics. Is it possible to do this any other way.

Thanks

Update:

I have added a request for split function here.., would appreciate if you guys voted for the same..


Solution

  • I wish Stream Analytics had a split function. You may have to use CHARINDEX and SUBSTRING for now: https://msdn.microsoft.com/en-us/library/azure/dn835064.aspx

    It's a bit of a pain, but the following should work:

    SELECT mystring
    ,SUBSTRING(
      mystring
      ,0
      ,CHARINDEX('.',mystring)
     ) as segment1
    ,SUBSTRING(
      mystring
      ,CHARINDEX('.',mystring)+1
      ,CHARINDEX('.',mystring,CHARINDEX('.',mystring)+1) - CHARINDEX('.',mystring) - 1
     ) as segment2
    ,SUBSTRING(
      mystring
      ,CHARINDEX('.',mystring,CHARINDEX('.',mystring)+1)+1
      ,999
     ) as segment3
    from myinput
    

    I would request a split function here (and post the link so we can vote): http://feedback.azure.com/forums/270577-azure-stream-analytics