如何更改 Sql Server 中十进制列的精度? [英] How do I alter the precision of a decimal column in Sql Server?

查看:41
本文介绍了如何更改 Sql Server 中十进制列的精度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法改变 Sql Server 中现有十进制列的精度?

Is there a way to alter the precision of an existing decimal column in Sql Server?

推荐答案

ALTER TABLE Testing ALTER COLUMN TestDec decimal(16,1)

只需输入decimal(precision, scale),用您想要的值替换精度和小数位数.

Just put decimal(precision, scale), replacing the precision and scale with your desired values.

我没有对表中的数据进行任何测试,但是如果您更改精度,如果新精度较低,您可能会丢失数据.

I haven't done any testing with this with data in the table, but if you alter the precision, you would be subject to losing data if the new precision is lower.

这篇关于如何更改 Sql Server 中十进制列的精度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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