Question: Use MICROSOFT SQL SERVER language to fill the block like (...) Here is the diagram 1)Create a trigger that can update the ItemNum field automatically
Use MICROSOFT SQL SERVER language to fill the block like (...)
Here is the diagram

1)Create a trigger that can update the ItemNum field automatically

The trigger should be create on InvoiceItemeven if the modified value will be in the Invoice table. We use the inserted and deleted tabled to update the amount of items. The solution is complicated since at the inserted table, we group by invoice number.
2)Test the trigger. The command, the expected and the real results should be documented.
update InvoiceItem
set ..................... write here you code
Payment Method Order ID 9 ID Date Method Deadline PlaceOfBusiness ID Zip Code City Street Deadline PlaceOfBusinessID StatusID Payment Methodid Customer Y ID Name BankAccount Login Password Email MainPlaceOfBusiness Fax Customer Status 8 ID Name Invoicelssuer 9 ID Orderltem ID Amount Price Order D ProductiD StatusID Category 9 ID Invoice* Y ID CustomerName CustomerZipCode Customer City Customer Street PrintedCopies Cancelled Payment Method CreationDate DeliveryDate Payment Deadline InvoicelssuerlD Order Name ZipCode City Street Taxidentifier BankAccount Name ParentCategory Product VAT Y ID Name Invoiceltem Price Percentage Name Amount InStock VATID CategoryID Description Image Price VATPercentage InvoicelD OrderitemID create trigger Invoice ItemNumTG on Invoiceltem after insert, update, delete as begin update Invoice set itemNum = ItemNum + change from Invoice inner join (.....................) write here you code update Invoice set itemNum = ItemNum - change from Invoice inner join (.....................) write here you code end Payment Method Order ID 9 ID Date Method Deadline PlaceOfBusiness ID Zip Code City Street Deadline PlaceOfBusinessID StatusID Payment Methodid Customer Y ID Name BankAccount Login Password Email MainPlaceOfBusiness Fax Customer Status 8 ID Name Invoicelssuer 9 ID Orderltem ID Amount Price Order D ProductiD StatusID Category 9 ID Invoice* Y ID CustomerName CustomerZipCode Customer City Customer Street PrintedCopies Cancelled Payment Method CreationDate DeliveryDate Payment Deadline InvoicelssuerlD Order Name ZipCode City Street Taxidentifier BankAccount Name ParentCategory Product VAT Y ID Name Invoiceltem Price Percentage Name Amount InStock VATID CategoryID Description Image Price VATPercentage InvoicelD OrderitemID create trigger Invoice ItemNumTG on Invoiceltem after insert, update, delete as begin update Invoice set itemNum = ItemNum + change from Invoice inner join (.....................) write here you code update Invoice set itemNum = ItemNum - change from Invoice inner join (.....................) write here you code end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
