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

after update trigger

Status
Not open for further replies.

jamert

Programmer
Dec 9, 2007
80
CA
Hi, i've confused with triggers, still trying to wrap my head around the logic syntax, belowis what i have wich isn't working. when clientportal db table [_Info] gets an insert to take the autoIncrementing MemberID and insert it into db clientportalforms.dbo.mcpage1 in a column called MemberID.

what am i doing wrong?

Code:
ALTER TRIGGER [ClientPortalForms].[dbo].[InsertMCforms]
ON [ClientPortal].[dbo].[_Info]
AFTER INSERT
AS
BEGIN
UPDATE [ClientPortalForms].[dbo].[MCPage1]
SET [ClientPortalForms].[dbo].[MemberID] = [ClientPortal].[dbo].[MemberID]
FROM [ClientPortalForms].[dbo].[MCPage1], inserted
WHERE [ClientPortalForms].[dbo].[MCPage1].[MemberID] = inserted.MemberID
END
 
If you want to INSERT
and insert it into db clientportalforms.dbo.mcpage1 in a column called MemberID

than INSERT it, not UPDATE.

Code:
ALTER TRIGGER [ClientPortalForms].[dbo].[InsertMCforms]
ON [ClientPortal].[dbo].[_Info]
AFTER INSERT
AS
BEGIN
   INSERT INTO [ClientPortalForms].[dbo].[MCPage1] (MemberId)
   SELECT [MemberID] FROM inserted
END

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
Microsoft MVP VFP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top