sql server - T-SQL Azure Stream Analytics Rounding to Minute -


i have following select clause in azure stream analytics query:

select dateadd(mi, datediff(mi, 0, dateadd(s, 30, max(timecreated))), 0) 'timestamp'

which giving following error:

second parameter of 'datediff' in expression 'datediff ( mi , 0 , dateadd(s, 30, max ( timecreated ) ) )' has invalid type 'bigint'. 'datetime' expected.

admittedly, code i'm using copied several similar threads on stackoverflow, such t-sql datetime rounded nearest minute , nearest hours using functions, i've no idea change 0 in scenario.

it should have auto cast 0 bigint datetime, there may quirks azure version of t-sql. instead, use:

select dateadd(mi,    datediff(mi, cast('1900-01-01 00:00:00.000' datetime),      dateadd(s, 30, max(timecreated))),   cast('1900-01-01 00:00:00.000' datetime)) 'timestamp' 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -