Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
ALTER TRIGGER [dbo].[UpdateDNNRole_DNN_IMIS] ON [dbo].[Orders]AFTER insert asBeginSET NOCOUNT ONUpdate dbo.DNN_IMIS_SECURITY_NAME set dbo.DNN_IMIS_SECURITY_NAME.SECURITY_ROLE='5' where dbo.DNN_IMIS_SECURITY_NAME.ID=(Select dbo.Orders.BT_ID from dbo.Ordersinner join dbo.Order_Lines on dbo.Orders.Order_Number=dbo.Order_lines.Order_Number wheredbo.Order_Lines.Product_code like 'GRANT08%' and dbo.Orders.Order_date =(select max(dbo.ORDERS.ORDER_DATE) from dbo.ORDERS ) )My query works when i execute separetly..But donno why the trigger is not fired when there is an insert on ORDERS table.Please help me outSoumya
ALTER TRIGGER dbo.UpdateDNNRole_DNN_IMIS ON dbo.OrdersAFTER INSERTASSET NOCOUNT ONUPDATE tSET t.SECURITY_ROLE = '5' FROM dbo.DNN_IMIS_SECURITY_NAME AS tINNER JOIN inserted AS i ON i.BT_ID = t.IDINNER JOIN dbo.Order_Lines AS ol ON ol.Order_Number = i.Order_NumberWHERE ol.Product_code LIKE 'GRANT08%' AND i.Order_date = (SELECT MAX(Order_date) FROM dbo.Orders)