So I keep getting an error and I have no clue what is prompting it. I have the SQL
STUFF(STUFF(STUFF(CAST(((ETADate * 10000) + ETATime) * 100 AS NVARCHAR),13,0,':'),11,0,':'),9,0,' ')
Which produces on the problem line the value :
When I call the following SQL, the DateTime conversion works just fine.
CONVERT(DATETIME, '20161102 00:50:00')
But when I try to put both together with the following:
CONVERT(DATETIME, STUFF(STUFF(STUFF(CAST(((ETADate * 10000) + ETATime) * 100 AS NVARCHAR),13,0,':'),11,0,':'),9,0,' '))
Then and only then, I get the error "The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value."
Does anyone here have any clue as to why the my nvarchar to datetime conversion works when I manually supply a string but fails when I try to convert from math that generates the exact same string? Any insight anyone has would be great because as of now this makes absolutely no sense.