Error on creating a stored procedure

  • Hi,

    I have the stored proc that I am creating but recive an error :

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near 'END'.

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    CREATE TRIGGER trigger1 ON test_tbl

    FOR UPDATE

    AS

    UPDATE test_tbl

    SET datechanged = getdate()

    WHERE id in (SELECT i.id FROM Inserted i)

    SET NOCOUNT ON;

    END

    Any idea why this will not create?

  • You have an END without a BEGIN. Remove the END or add a matching BEGIN.

    p.s. Shouldn't the NOCOUNT ON be before the update, not after?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Gail,

    Your right I did looking review the code - thanks!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply