Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Trigger on "CREATE TABLE"

Posted on 2004-08-18
5
Medium Priority
?
385 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how the fundamental information of how to create a table.

609 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