Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Posts
    9

    Unanswered: Syntax Error help needed

    Below is a trigger I am working on. I am receiving several errors and do not know how to resolve. One of the Errors is the line that says 'IF @ClearBy IS NULL' There are also other errors with the IF statement. Please help. I am new at this.


    CREATE Trigger trg_employees
    On dbo.TROUBLE
    For Update
    AS

    Declare @Comment nvarchar(1000)
    Declare @TechnicianRemarks nvarchar(1000)
    Declare @ClearBy nvarchar(25)
    Declare @ClearDate datetime
    Declare @ClearTime datetime
    Declare @Type nvarchar(50)

    Select @Comment = Comment FROM INSERTED
    Select @TechnicianRemarks = Resolution FROM INSERTED
    Select @ClearBy = ClearBy FROM INSERTED
    Select @ClearDate = ClearDate FROM INSERTED
    Select @ClearTime = ClearTime FROM INSERTED
    Select @Type = Type FROM INSERTED

    /*Check to see if the ClearBy field is NULL. We only want to send an email
    if the ClearByField is NOT NULL.
    */
    IF @ClearBy IS NULL
    BEGIN
    --do nothing
    END

    ELSE
    --Now Check to see if the ticket is a Service Order (SO) or a Trouble Ticket (TR)
    IF @Type = 'SO'
    BEGIN


    END

  2. #2
    Join Date
    May 2002
    Location
    Shanghai,China
    Posts
    4

    my advice

    IF @ClearBy IS NOT NULL
    BEGIN
    --here U must do sth.,such as send an e-mail.
    END

    Pls have a try ,and tell me the result.

  3. #3
    Join Date
    May 2002
    Posts
    9

    That Worked

    That took care of the problem. Thanks a bunch

Posting Permissions

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