Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert select statement into INSERT INTO

Status
Not open for further replies.

jacob94

Technical User
Dec 5, 2005
161
US
Can some help me convert the below select statement into an FOR INSERT TRIGGER:

SELECT s.ID, c.IsD
FROM dbo.AA_STABLE
s INNER JOIN dbo.VTABLE v ON s.PTC COLLATE SQL_Latin1_General_CP1_CI_AS = v.PTC
LEFT OUTER JOIN dbo.CCTABLE c ON s.ID COLLATE SQL_Latin1_General_CP1_CI_AS = c.ID


I need to use the INSERT INTO tblFINALTABLE using the FOR INSERTED records command because I want to process each record as they are inserted. I am able to do this myself when one table is involved but I am confused when I am joining multiple tables together. The dbo.AA_STABLE is the table the trigger will be placed on.
 
I think I got it...

Would I just change:

FROM dbo.AA_STABLE s

to

FROM inserted s

and call it a day???

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top