舍入小数位数
答
某些DBMS产品有round
:
round(brutto,2)
ANSI SQL的方式将是一个双cast
:
cast((cast(brutto as decimal (12,2)) as decimal(15,5))
答
在任何数据库,你可以做到这一点通过转换为有两位小数的decimal
。例如:
select cast(brutto as decimal(10, 2))
许多数据库也会让你改变列的类型。例如:
alter table brutto alter brutto decimal(10, 2);
但是,并非所有的数据库都支持这种(或类似的)语法。
答
实测值的溶液:
UPDATE acc_data SET brutto = ROUND(brutto,2) 其中DOC_ID = '00C19695AB574568B9590508A4601E9F'
哪个DB味道?该列的数据类型是什么?你想选择或插入舍入?你能改变表格的定义吗? – spender