在 SQL Server 中不使用科学计数法将 float 转换为 varchar [英] Convert float into varchar in SQL Server without scientific notation

查看:28
本文介绍了在 SQL Server 中不使用科学计数法将 float 转换为 varchar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 SQL Server 中将 float 转换为 varchar,无需科学计数法和小数位.

Convert float into varchar in SQL Server without scientific notation and trimming decimals.

例如:

我有浮点值1000.2324422,然后它会像1000.2324422一样转换成varchar.

I have the float value 1000.2324422, and then it would be converted into varchar as same 1000.2324422.

可以有任意数量的十进制值...浮点值随机出现.

There could be any number of decimal values...the float value comes randomly.

推荐答案

使用大整数强制转换或转换为 VARCHAR(MAX) 或其他任何不起作用对我有用(在浮点字段中)例如 167382981,它总是出现 '1.67383e+008'.

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'.

做了什么STR().

这篇关于在 SQL Server 中不使用科学计数法将 float 转换为 varchar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆