Microsoft
Software
Hardware
Network
Question : Adding multiple values on insert trigger
Hello,
I have a sql trigger that grabs a value from a newly inserted table and uses it create a record and populate the foreign key value in another table. This all works fine. I would like to grab another value and insert it and just want to know the correct syntax for it.
This is the trigger:
Create TRIGGER [dbo].[trg_OrderInsert]
ON [dbo].[orders_tbl]
AFTER Insert
AS
BEGIN
SET NOCOUNT ON;
Insert into Services_tbl
( orderID )
Select orderID
From inserted
END
If I wanted to grab productID and insert that into Service_tbl as well how would I do that? Would it be like this?:
Insert into Services_tbl
( orderID, productID )
Select orderID, productID
From inserted
Answer : Adding multiple values on insert trigger
if productID is a column in order_tbl, what you've written will work
Random Solutions
Calculating VAT
How to flush cache consistently?
How do I force an autopostback from a textbox in asp.net after each keystroke
Non-AD Logoff/Shutdown Script?
I have Joomla 1.5 installed, and installed DocMan plugin. Docman works in all respects except users cannot download files that are properly displayed. All files are 777 on the server. Any ideas?
How do you disable auto email address populator in Outlook 2003
AD - two DCs and wrong time server
0x86000108 error code with Exchange ActiveSync
SEO - Common doubts
convert to lowercase