sql server 中对小数进行保留位数
2017-12-14 00:00
459 查看
摘要: 对数字进行保留位数
1.效果
select cast(round(12.1255587156,2) as numeric(20,2)) as value
2.将其他类型的数据转化为 字符串类型
-- 结果是float类型
select cast(round(12.1255587156,2) as numeric(20,2)) as value
-- 结果是 字符串类型了
select convert(varchar,cast(round(12.1255587156,2) as numeric(20,2)) ) as value
1.效果
select cast(round(12.1255587156,2) as numeric(20,2)) as value
2.将其他类型的数据转化为 字符串类型
-- 结果是float类型
select cast(round(12.1255587156,2) as numeric(20,2)) as value
-- 结果是 字符串类型了
select convert(varchar,cast(round(12.1255587156,2) as numeric(20,2)) ) as value
相关文章推荐
- JavaScript基础 toFixed() 将一个数值转成字符串,并进行四舍五入,保留指定位数的小数
- JavaScript基础 toFixed() 将一个数值转成字符串,并进行四舍五入,保留指定位数的小数
- smarty应用1 之 模板进行数学运算,保留小数位数
- 关于将数字字符串保留小数位数,不进行四舍五入
- sql server 保留小数,向上保留指定位数的小数,仅记录,勿看。
- SQL Server 中对数据进行千分化,可以保留任何位数(money类型)
- js对浮点数进行四舍五入,按需要保留小数位数
- Python中的math和保留小数位数方法
- C#double转化成字符串 保留小数位数, 不以科学计数法的形式出现。
- java处理浮点数保留指定小数位数的方法
- Java_语法基础_保留指定位数小数
- java 小数位数保留的几种方法
- 总结C#保留小数位数
- js数据保留小数位数
- javascript js保留小数位数的方法
- C# decimal保留指定的小数位数,不四舍五入
- 如何在datagrid中将表中的数值进行小数点位数保留
- 初学Java:保留小数位数方法
- JS对数字进行货币格式化并且保留两位小数点,小数用0补全
- sql Server 保留几位小数