我在getDate()上获得了一个UnExpected IDENT_QUOTED,你能看到问题吗?
CREATE TABLE IF NOT EXISTS Loading
(
L_Id INT,
PO_Id INT NOT NULL,
LD_Id INT NOT NULL,
LE_Id INT,
W_Id INT NOT NULL,
RemainingWieght DOUBLE,
ExpectedStart DATETIME NOT NULL DEFAULT GETDATE(),
ExpectedEnd TIMESTAMP,
LoadingStatus ENUM('ASSIGNED', 'IN_PROCESS', 'STOPPED', 'COMPLETED'),
PRIMARY KEY (L_Id),
FOREIGN KEY (`PO_Id`) REFERENCES `PartOder` (`PO_Id`),
FOREIGN KEY (`LD_Id`) REFERENCES `LoadingDock` (`LD_Id`),
FOREIGN KEY (`LE_Id`) REFERENCES `LoadingError` (`LE_Id`),
FOREIGN KEY (`W_Id`) REFERENCES `Weighing` (`W_Id`)
);
答案 0 :(得分:0)
在MSSQL中,getDate()是非确定性的
我认为这可能意味着您应该将约束作为单独的声明添加:
ALTER TABLE MyTable
ADD CONSTRAINT DF_MyTable_MyColumn
DEFAULT GETDATE() FOR MyColumn
但这有点猜测......它还具有命名约束的优势......
HTH