July 29, 2011 at 1:15 pm
Can we Create Trigger on Stored Procedure in SQL Server 2008:-)
July 29, 2011 at 1:19 pm
CREATE PROC ...
AS
BEGIN
DECLARE @strSQL varchar(4000)
SET @strSQL = 'CREATE TRIGGER....'
exec (@strSQL)
END
July 29, 2011 at 1:27 pm
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?
July 29, 2011 at 1:29 pm
may be he is dynamically creating the table and using that table for other steps...
July 29, 2011 at 1:34 pm
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. 😉
July 29, 2011 at 1:55 pm
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
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply