473,394 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Trigger to modify a table

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
3 1537
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: kevin jin | last post by:
Hi, I did read Andrew's article about SQL Server trigger. After a 'Insert' trigger is fired,is there any way we can modify newly added data in virtual 'Insert' table before put them to the...
2
by: robert | last post by:
i've found the solution threads on changing a column on insert. works fine. question: - will one package serve for all such triggers, or does there need to be a package defined to support...
1
by: Dunc | last post by:
I'm new to Postgres, and getting nowhere with a PL/Perl trigger that I'm trying to write - hopefully, someone can give me some insight into what I'm doing wrong. My trigger is designed to reformat...
10
by: Lauren Quantrell | last post by:
I have never written a trigger before and now am seeing the light. Is there a way to write a trigger so that if a user changes any column in a single row on one table then the trigger will write...
4
by: nosbtr1 | last post by:
When a row gets modified and it invokes a trigger, we would like to be able to update the row that was modified inside the trigger. This is (basically) how we are doing it now: CREATE TRIGGER...
2
by: Bruce | last post by:
I have an application written for version 8 that uses an INSTEAD OF trigger, and I need to convert it to support someone that needs it for v7. Is there a way to achieve similar functionality in...
18
by: Bill Smith | last post by:
The initial row is inserted with the colPartNum column containing a valid LIKE pattern, such as (without the single quotes) 'AB%DE'. I want to update the column value with the results of a query...
4
by: Együd Csaba | last post by:
Hi, I created a trigger function and a trigger with that function on a table. It is an "after insert or update or delete" trigger, in which I want to modify a second table regardless of the...
2
by: fatjoez | last post by:
Hi there. I'm trying to create a Trigger for on insert, which will be triggered upon any attempted insert into a database table item. Basically want it to say, if the attempted insert value for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.