【发布时间】:2015-01-08 02:43:47
【问题描述】:
使用 SQL Server 2012...
我有两列:
Price [decimal(28,12)]
OustandingShares [decimal(38,3)] -- The 38 is overkill but alas, not my call.
当我执行 ALTER TABLE 时,我得到一个作为 [decimal(38,6)] 的计算列。我需要数据类型为 [decimal(28,12)]。
ALTER TABLE [xyz].MyTable
ADD Mv AS OustandingShares * Price
如何在此计算列上有效地获得 12 位小数?我已经尝试将OutstandingShares 转换为小数点后12 位,并围绕OutstandingShares * Price 进行转换。我得到的唯一结果是 [decimal(28,12)] 处的计算域,其中有六个尾随零。
想法?
【问题讨论】:
标签: sql-server tsql precision sqldatatypes