Convert float into varchar in SQL Server without scientific notation
Solution 1:
Casting or converting to VARCHAR(MAX)
or anything else did not work for me using large integers (in float fields) such as 167382981, which always came out '1.67383e+008'.
What did work was STR()
.
Solution 2:
Neither str()
or cast(float as nvarchar(18))
worked for me.
What did end up working was converting to an int and then converting to an nvarchar like so:
convert(nvarchar(18),convert(bigint,float))