This condition that compares shour
with datetime
is the problem:
xxxxxxxxxx
ON t.shour = dbo.dummy_float.datetime
shour
is anNVARCHAR
expression as it is the output ofFORMAT()
datetime
is of typedatetime
It’s not exactly clear what the condition is trying to accomplish there but in order to evaluate it, SQL Server is trying to convert the values in one of the two columns into the other datatype and failing, as for example an shour that has the value of '20'
cannot be converted to datetime.