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 Shaun E 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.

yuchieh

MIS
Jul 21, 2000
178
US
I want to set up a trigger so when I delete a record in table1, the same(related) reocrd in table2 can be deleted automatically.

Here is the query I put in --

CREATE TRIGGER Delete_Leave_Trigger ON Calendar
FOR DELETE AS
DECLARE @CalendarID INTEGER
DELETE FROM LeaveDate Where CalendarID = CalendarID


The result is when I delete a record in table1, "all" records in table2 are deleted. If I change "@CalendarID" in the query to "@CalendarID_d", it says the syntax is not correct.

Help please.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top