By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,379 Members | 1,435 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,379 IT Pros & Developers. It's quick & easy.

Trigger to modify a table

P: n/a
I have a 3rd party program that creates some tables in my sql server
2005 database, then it does inserts on the tables. Is there a way I
could create a system level trigger that would immediately and
automatically modfiy the table structure after the table is created
(hopefully before the inserts occur)? I need to change a field from
numeric(5, 0) to numeric(15, 0).
Thanks,
Roger
Mar 18 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Tue, 18 Mar 2008 11:57:46 -0700 (PDT), Ro******@gmail.com wrote:

No. Triggers come only in three flavors: insert, update, delete.

Contact the vendor of that program.

-Tom.
>I have a 3rd party program that creates some tables in my sql server
2005 database, then it does inserts on the tables. Is there a way I
could create a system level trigger that would immediately and
automatically modfiy the table structure after the table is created
(hopefully before the inserts occur)? I need to change a field from
numeric(5, 0) to numeric(15, 0).
Thanks,
Roger
Mar 19 '08 #2

P: n/a
On Tue, 18 Mar 2008 11:57:46 -0700 (PDT), Ro******@gmail.com wrote:
>>I have a 3rd party program that creates some tables in my sql server
2005 database, then it does inserts on the tables. Is there a way I
could create a system level trigger that would immediately and
automatically modfiy the table structure after the table is created
(hopefully before the inserts occur)? I need to change a field from
numeric(5, 0) to numeric(15, 0).
I'm afraid that Tom was incorrect. You can indeed to this on SQL 2005.
Whether it's a good idea with regards to your license agreement etc is
another matter. But the change appears harmless to me.

Start with looking at the CREATE TRIGGER topic in Books Online and
read about DDL triggers. The topic has links to more detailed topics.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Mar 19 '08 #3

P: n/a
On Mar 19, 6:41*pm, Erland Sommarskog <esq...@sommarskog.sewrote:
On Tue, 18 Mar 2008 11:57:46 -0700 (PDT), RogBa...@gmail.com wrote:
>I have a 3rd party program that creates some tables in my sql server
2005 database, then it does inserts on the tables. Is there a way I
could create a system level trigger that would immediately and
automatically modfiy the table structure after the table is created
(hopefully before the inserts occur)? I need to change a field from
numeric(5, 0) to numeric(15, 0).

I'm afraid that Tom was incorrect. You can indeed to this on SQL 2005.
Whether it's a good idea with regards to your license agreement etc is
another matter. But the change appears harmless to me.

Start with looking at the CREATE TRIGGER topic in Books Online and
read about DDL triggers. The topic has links to more detailed topics.

--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Thanks Erland, that does look interesting. I have been experimenting
with the DDL trigger and I may get that to do something for me.
-Roger
Mar 22 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.