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

TRIGGER

Status
Not open for further replies.

roxy31

Programmer
Nov 23, 2010
1
NI
tom31 - 11-23-2010 13:49
hello

i have a table named Articles with the fields idarticle, namearticle, price

i have another table named Ware with another fields but the most important is
amount

i have a table named existence with the fields idarticle, namearticle,
existence

i made a trigger in Articles table so when i add they will insert into
existence

but i need to make another trigger in Ware table so when i insert the amount
it will insert into Existence table too but in the row that belongs. I mean i
had made one trigger but the amount was inserted in a new row and it has to
be inserted in the row where its idarticle belongs.

any help? i will be really grateful
 
Maybe this example will lead you to what you're needing:
Code:
CREATE TRIGGER trg_AssemblyLine_Audits
ON AssemblyLine
FOR INSERT, UPDATE
AS
UPDATE AssemblyLine
SET ModifiedBy = SUSER_SNAME(),
	ModifyHost = HOST_NAME(),
	ModifyDate = GETDATE()
FROM AssemblyLine al
	[b]INNER JOIN Inserted i on al.AsyLineId = i.AsyLineId[/b];

--------------------------------------------------
“Crash programs fail because they are based on the theory that, with nine women pregnant, you can get a baby a month.” --Wernher von Braun
--------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top