Is there a way to run some function like a trigger when a table is created in the database in SQL SERVER 2008?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, it’s called a DDL trigger. The documentation for
CREATE TRIGGERhas a sample forDROP_SYNONYM(a very questionable choice for an example) but you’ll want theCREATE_TABLEevent instead. A better starting point in understanding how they work is probably here:http://msdn.microsoft.com/en-us/library/ms190989.aspx
If you have more specific details, e.g. what exactly do you want to pass to this function (I assume you mean procedure), or what does the procedure do, we can provide more useful and specific help.