本文介绍了将Float转换为Varchar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个电话号码为FLOAT的旧表.我想将其转换为VARCHAR.示例:

I have a legacy table with a phone number as FLOAT. I would like to convert it to VARCHAR. Example:

SELECT
    [PhoneNumber01] AS FloatPhone,
    CONVERT(varchar(50), PhoneNumber01, 2) AS ConvertPhone,
    CAST([PhoneNumber01] AS VARCHAR(15)) AS CastPhone
FROM OurTable


输出为:
< text>
FloatPhone ----- ConvertPhone --------------- CastPhone
9995553605 ---- 9.995553605000000e + 009 ---- 9.99555e + 009

有没有一种解决方案,或者我需要使用字符串操作来删除多余的内容(科学记数法)吗?

谢谢
djj


with the output of:
<text>
FloatPhone ----- ConvertPhone --------------- CastPhone
9995553605 ---- 9.995553605000000e+009 ---- 9.99555e+009

Is there a one step solution or do I need to use string manipulation to remove extras (scientific notation)?

Thanks
djj

推荐答案


这篇关于将Float转换为Varchar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 23:22