August 9, 2011 at 11:02 am
Hello folks
I´d like to know if I can create a trigger that verifies procedure name exists into a catalog table, this case I´d like to force an user insert a catalog table before create a procedure.
best regards
August 9, 2011 at 11:11 am
You can use DDL triggers to fire on creation of a procedure. They can check values in tables. Will that do what you need?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
August 9, 2011 at 12:17 pm
GSquared (8/9/2011)
You can use DDL triggers to fire on creation of a procedure. They can check values in tables. Will that do what you need?
In fact I would like to search for procedure name into a table before. If i create a trigger create before I wouldn´t like to send any kind of create object.
August 9, 2011 at 12:28 pm
ulisseslourenco (8/9/2011)
GSquared (8/9/2011)
You can use DDL triggers to fire on creation of a procedure. They can check values in tables. Will that do what you need?In fact I would like to search for procedure name into a table before. If i create a trigger create before I wouldn´t like to send any kind of create object.
so something during the scripting process? and not a trigger at all, really?
IF EXISTS (SELECT 1 FROM SomeTable where value='NewPProcName')
BEGIN
EXEC 'CREATE PROCEDURE ....'
END
ELSE
BEGIN
PRINT 'You must have added the table before we add the procedure?'
END
Lowell
August 9, 2011 at 2:35 pm
Lowell (8/9/2011)
ulisseslourenco (8/9/2011)
GSquared (8/9/2011)
You can use DDL triggers to fire on creation of a procedure. They can check values in tables. Will that do what you need?In fact I would like to search for procedure name into a table before. If i create a trigger create before I wouldn´t like to send any kind of create object.
so something during the scripting process? and not a trigger at all, really?
IF EXISTS (SELECT 1 FROM SomeTable where value='NewPProcName')
BEGIN
EXEC 'CREATE PROCEDURE ....'
END
ELSE
BEGIN
PRINT 'You must have added the table before we add the procedure?'
END
However We don´t create a procedure from a script file, blocking in Management Studio will be better.So I thought about a trigger instead of script.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply