Results 1 to 2 of 2
  1. #1
    Join Date
    May 2003
    Location
    Pinoy in NJ
    Posts
    104

    Question Unanswered: [RESOLVED] What's wrong with my TRIGGER?

    On my VB form, user terminates an employee by entering a date on a textbox control (EndDate). When saving the edited record, I get a run time error "- 2147217871 TIMEOUT EXPIRED".

    When I remove the trigger, record is saved with no problems. What's wrong with the trigger? It used to work before the last time I can remember.

    Code:
    CREATE TRIGGER tr_TERMINATE ON dbo.Employee 
    FOR UPDATE
    AS
    
    DECLARE @EndDate smalldatetime
    DECLARE @EmployeeID int
    
    SELECT @EndDate = EndDate FROM inserted
    SELECT @EmployeeID = EmployeeID FROM inserted
    
    IF @EndDate is not null 
    BEGIN
    	UPDATE SubStore SET EmployeeID = 10000 WHERE EmployeeID=@EmployeeID
    	UPDATE Store SET EmployeeID = 10000, [Permanent] = 0 WHERE EmployeeID=@EmployeeID
    	UPDATE WOTemp SET EmployeeID=10000 WHERE EmployeeID=@EmployeeID
    	DELETE EmpBuddy WHERE BuddyID=@EmployeeID
    END

    Last edited by ARPRINCE; 06-18-03 at 17:00.

  2. #2
    Join Date
    May 2003
    Location
    Pinoy in NJ
    Posts
    104
    After trying to figure out almost half a day what's wrong with this trigger (it used to work before!!), I see that it was crapping out on the first UPDATE statement. I tried each UPDATE statement and it was not working too.

    I even used SQL Server Query Analizer and it was also not doing the update commands.

    Heck, I rebooted my PC and it worked like a charm afterwards. I can only shake my head right now. Ohhh well, at least my problem is gone.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •