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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trigger on a View help

Status
Not open for further replies.

a5b5c5

MIS
Joined
Oct 18, 2006
Messages
7
Location
US
Hi,
I created two seprate triggers for insertion and updates from a view on a database A to to multiple tables on database B.But when I tried to test the trigger by inserting records on the view on database A, the trigger did'nt do anything.Can anybody help me on this?

Insertion Trigger Syntax

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

ALTER TRIGGER NigelInsert
ON SALESFORCESBK.dbo.SALESFORCETONIGELINSERTVIEW
INSTEAD OF INSERT
AS
-----------------------------------------------------------
BEGIN
INSERT INTO Main4.dbo.Part_Term
(Date,
Part_ID,
Co_ID,
User_ID,
Wage,
Title,
h_ind,
h_fam,
sl,
va,
pention,
bonded,
no_benefits,
hours_per_week,
commute_time_to_work,
job_start_date,
contact_id
)

Select
Term_Date,
Part_ID,
Co_ID__c,
User_ID,
Hourly_Wage__c,
Job_Title ,
Health_Indiv__c,
Health_Family__c,
Sick_Leave__c,
Vacation__c,
Pension__c,
Bonded__c,
Convert(char,Benefits__c),
Hours_Per_Week__c,
Commute_time__c,
Job_Start_Date__c,
Contact_ID__c
from inserted

END
----------------------------------------------------------
BEGIN
INSERT INTO
Main4.dbo.Follow_Up
(Part_ID,
Follow_Date,
Reason_id,
Still_Employed,
Follow_Days,
Term_Date
)
SELECT
Part_ID,
DATEADD(DD,30,Job_Start_Date__c),
100,
NULL,
30,
Term_Date
from inserted

END
-----------------------------------------------------------
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO


Your help wil be greatly appreciated.

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top