我正在尝试创建此表,它显示错误“小数位数必须为0并且总位数”
Create Table DBL2.WorkOrderRouting
(
WorkOrderID int,
ProductID Varchar(10),
OperationSequence int,
LocationID Varchar(10),
ScheduledStartDate Date,
ScheduledEndDate Date,
ActualStartDate Date,
ActualEndDate Date,
ActualResourceHrs Decimal (1,2),
PlannedCost Decimal (2,2),
ActualCost Decimal (2,5)
) Primary Index (WorkOrderID,ProductID,OperationSequence);
十进制似乎很好,我不明白。问题出在哪里!
答案 0 :(得分:0)
您需要以另一种方式指定DECIMAL
。第一个值必须高于第二个值:
Create Table DBL2.WorkOrderRouting
(
WorkOrderID int,
ProductID Varchar(10),
OperationSequence int,
LocationID Varchar(10),
ScheduledStartDate Date,
ScheduledEndDate Date,
ActualStartDate Date,
ActualEndDate Date,
ActualResourceHrs Decimal (3,2),
PlannedCost Decimal (4,2),
ActualCost Decimal (7,5)
) Primary Index (WorkOrderID,ProductID,OperationSequence);
您可以找到以下示例on the documentation:
考虑数字256.78。其类型为DECIMAL(5,2)