I am having to change one of the columns in table which currently is Float to Varchar, but when I use alter command, it stores some of the longer numbers in Scientific Notation.
Can I avoid this?
If not, is there a way to easily update the table later to store the scientific notation as normal integer?
Please check the link
<a href="https://stackoverflow.com/questions/6521354/convert-float-into-varchar-in-sql-server-without-scientific-notation" rel="nofollow">convert float into varchar in SQL server without scientific notation</a>
You can cast the float to varchar(max)
<a href="https://stackoverflow.com/questions/3715675/how-to-convert-float-to-varchar-in-sql-server" rel="nofollow">How to convert float to varchar in SQL Server</a>Answer2:
I have a workaround for this I have used in the past. Dan isn't far off, but just casting it won't work. You can alter the table by adding a new varchar column then using str and ltrim to update the new column from the old float column. Say your varchar column was varchar(50), use something like:
update YourTable set NewColumn = ltrim(str(OldColumn, 50))
str() converts to character data, ltrim() gets rid of any extra blanks on the left. You can then always get rid of the old column. Feels janky but should work for you.