Solved

Trigger on "CREATE TABLE"

Posted on 2004-08-18
5
375 Views
Last Modified: 2008-03-06
Is it possible to have a trigger fire off when a table is created? I know it's not possible to add a trigger to the sysobjects table, and I think I'll just have to run a process to check for changes every once in a while. I would like to see if anybody knows if this can be done though. I'm modifying some 3rd party software, and there is a set of tables that only exist when specific user-defined fields are created in the software. I'm attaching triggers to those tables, but I can obviously only attach them after the tables have been created, so I would basically like a trigger that creates a trigger on a newly created table. Anybody know if this can be done?
0
Comment
Question by:espeir
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 15

Accepted Solution

by:
jdlambert1 earned 500 total points
ID: 11832595
Nope, trigger definitions are associated with a specific table, and you're right, it's not allowed on sysobjects, which is the only one that might help. Periodic checks are the way to go.
0
 
LVL 10

Expert Comment

by:kiranghag
ID: 11832596
Hi espeir,
create a test database and try to put the trigger on the sysobject table

this table is updated whenever a db object is created ...

but whats your specific requirement?

Kir@n

0
 
LVL 18

Expert Comment

by:SjoerdVerweij
ID: 11834571
FYI: SQL Server 2005 does support this.
0

Featured Post

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question