I unfortunately have some bad data and need to work around it. I have a Parcel column in a spreadsheet with some parcels that have inadvertently been converted to floating point numbers. I posted a question to solve this problem Handling sql column with mixed varchar and float data types However, now I am getting an error when I try the following code:
SELECT CAST(CAST(CAST([Parcel Number 2(max)] AS FLOAT) AS DECIMAL) AS NVARCHAR(255)) FROM XLSIMPORT WHERE [Parcel Number 2(max)] = '1.4515020001e+012'
The error I'm getting is:
Msg 8115, Level 16, State 6, Line 41 Arithmetic overflow error converting float to data type numeric.