locked
Incorrect syntax near '.' RRS feed

  • Question

  • Code Snippet

    CREATE TRIGGER [dbo].[tr_ActionChangesINSERTING_U] ON  [dbo].[Action]
       FOR UPDATE
    AS
    BEGIN
    SET NOCOUNT ON;
        IF( Inserted.CreatedID <> Deleted.CreatedID )
        begin
            exec ActionChanges_Insert Inserted.ID, 'CreatedID', 'int', Deleted.CreatedID, Inserted.CreatedID
        end

    END


    On the line
    exec ActionChanges_Insert Inserted.ID, 'CreatedID', 'int', Deleted.CreatedID, Inserted.CreatedID

    I get the error Incorrect syntax near '.'.

    Tuesday, July 22, 2008 8:35 AM

Answers

  • Try:

     

    Code Snippet

    declare @beforeCreatedID int

    declare @afterCreatedID int

    select @beforeCreatedID = CreatedID from Deleted

    select @afterCreatedID = CreatedID from Inserted

    IF( @beforeCreatedID <> @afterCreatedID )

    begin

    exec ActionChanges_Insert @afterCreatedID , 'CreatedID', 'int', @beforeCreatedID , @afterCreatedID

    end

     

     

     

     

    Tuesday, July 22, 2008 8:58 AM