我的任务有问题。我相信我的代码都能正常工作,但我总是收到语法错误,指出“Total”列不存在。我的印象是,当你使用“AS”时,它重命名了你正在使用的列。SQL Server FOR/AFTER触发器
这是我的代码任何指针将不胜感激。
Use [IST278EagleCorp13-1]
Go
Alter Trigger DPInvOrderTrigger
On InventoryPart
For insert
As
If exists (Select Count(ReorderLevel * 4) ReorderLevel,Count(StockOnOrder + StockLevel) AS Total
From InventoryPart
Where Total > ReorderLevel)
Begin
RaisError('Inventory to low. Transaction failed.',16,1)
rollback tran
End
这些是这个作业的方向。
/* Create a FOR|AFTER trigger named xxInvOrderTrigger for updates
to the InventoryPart table. If an update produces a record where
the (stockOnOrder + stockLevel) > (4 * reorderLevel) raise an
error (display an error) and rollback the change. */
触发器是** **非常特定供应商做到这一点 - 所以请更新你的标签告诉我们你正在使用的是什么**数据库**(以及哪个版本)(SQL只是查询语言 - 不是数据库) –