locked
Error writting in SQL Azure database RRS feed

  • Question

  • Hi,

    I have an error I don't really understand regarding the output of Stream Analytics in a SQL database. I really don't understand why it's not working. I've tried to cast the types as it's a type error but nothing really working.

    Any idea?

    Here is the error:

    Output adapter has encountered an error after processing [0] batches. Exception message at level [1], exception number [0], parent exception number [0]: Conversion from 1 to System.Double failed. 1 was of type - System.Int64. Exception message at level [2], exception number [0], parent exception number [0]: Conversion from 1 to System.Double failed. 1 was of type - System.Int64.

    Here is my request:

    SELECT
        CAST(WindSpeed as bigint) as speed,
        CAST(WindSpeedAverage as float) as average,
        CAST(WindDirection as bigint) as direction,
        CAST(SensorID as bigint) as sensorID
    FROM arrosageinput

    and my database is:

    CREATE

    TABLE[arrosage].[Wind](


        [id]         

    NVARCHAR (255)     CONSTRAINT[ColumnDefault_60db9908-8004-4c7b-bcc9-90503461ddd4] DEFAULT (CONVERT([nvarchar](255),newid(),(0)))NOTNULL,


        [__createdAt]

    DATETIMEOFFSET (3)CONSTRAINT[ColumnDefault_e0d78296-0961-4b7c-91c9-a8e46276942a] DEFAULT (CONVERT([datetimeoffset](3),sysutcdatetime(),(0)))NOTNULL,


        [__updatedAt]

    DATETIMEOFFSET (3)CONSTRAINT[ColumnDefault_ba589ce3-1c76-4618-b44f-c642322ec9ce] DEFAULT (CONVERT([datetimeoffset](3),sysutcdatetime(),(0)))NOTNULL,


        [sensorID]   

    INT                NULL,


        [speed]      

    INT         NULL,


        [direction]  

    INT                NULL,


        [average]    

    FLOAT (53)         NULL,


       

    CONSTRAINT[PrimaryKey_298aa6a0-7b9e-4d00-969c-55b3b690cf82] PRIMARYKEYCLUSTERED ([id] ASC)

    );

    Friday, May 29, 2015 4:48 PM

Answers

  • So I found the solution. In fact, with last modifications of Stream Analytics, when it comes to have a database as an output, it must be specified in the request. so:

    SELECT
        CAST(WindSpeed as bigint) as speed,
        CAST(WindSpeedAverage as float) as average,
        CAST(WindDirection as bigint) as direction,
        CAST(SensorID as bigint) as sensorID

    INTO arrosageoutput

    FROM arrosageinput

    casting is not necessary if entries are already the right type btw.

    • Marked as answer by Zafar Abbas Thursday, June 4, 2015 4:05 PM
    Tuesday, June 2, 2015 4:25 PM

All replies

  • Did you try using REAL instead of FLOAT(53) ?

    [Disclaimer] This posting is provided "AS IS" with no warranties, and confers no rights. User assumes all.

    Monday, June 1, 2015 6:01 PM
  • So I found the solution. In fact, with last modifications of Stream Analytics, when it comes to have a database as an output, it must be specified in the request. so:

    SELECT
        CAST(WindSpeed as bigint) as speed,
        CAST(WindSpeedAverage as float) as average,
        CAST(WindDirection as bigint) as direction,
        CAST(SensorID as bigint) as sensorID

    INTO arrosageoutput

    FROM arrosageinput

    casting is not necessary if entries are already the right type btw.

    • Marked as answer by Zafar Abbas Thursday, June 4, 2015 4:05 PM
    Tuesday, June 2, 2015 4:25 PM