Can we Create Trigger on Stored Procedure in SQL Server 2008

  • Can we Create Trigger on Stored Procedure in SQL Server 2008:-)

  • CREATE PROC ...

    AS

    BEGIN

    DECLARE @strSQL varchar(4000)

    SET @strSQL = 'CREATE TRIGGER....'

    exec (@strSQL)

    END

  • Why do you want to do that? Triggers are supposed to be at table (or view) level, not only 1 statement. Why not keep going in the proc and add more steups?

  • may be he is dynamically creating the table and using that table for other steps...

  • Ghanta (7/29/2011)


    may be he is dynamically creating the table and using that table for other steps...

    ... stil not the correct way to code this if this is the case. 😉

  • guptaprashant1982-1107326 (7/29/2011)


    Can we Create Trigger on Stored Procedure in SQL Server 2008:-)

    Create a trigger on a stored proc or create a trigger in a stored proc?

    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

Viewing 6 posts - 1 through 5 (of 5 total)

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