473,659 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copying triggers

Hi

I m new to DB2, Please bear with me if this is silly question, but i
need to know how to copy(only triggers) 400 triggers from one data
base to another on same server and also onto different server.
we use 8.1 on aix.

thanks
rik

Feb 7 '07 #1
3 2905
"rick" <ka*******@gmai l.comwrote in message
news:11******** **************@ k78g2000cwa.goo glegroups.com.. .
Hi

I m new to DB2, Please bear with me if this is silly question, but i
need to know how to copy(only triggers) 400 triggers from one data
base to another on same server and also onto different server.
we use 8.1 on aix.

thanks
rik
You can use the db2look utility to pull the DDL. You may have to pull the
entire database DDL, but the triggers will be grouped together in the
output. See the Command Reference manual.

The bad news is that you will have replace the last semi-colon in each
trigger with a different termination character (such as @) because triggers
use the semi-colon for terminating certain statements within the trigger.
Then you will have to run the script as follows:

db2 -td@ -vf script-name output

However, if you have a tool like DBArtisan, it is smart enough to know when
the trigger terminates and you can just run the script unmodified with ISQL.
Feb 7 '07 #2
On Feb 7, 4:25 am, "rick" <kantha...@gmai l.comwrote:
Hi

I m new to DB2, Please bear with me if this is silly question, but i
need to know how to copy(only triggers) 400 triggers from one data
base to another on same server and also onto different server.
we use 8.1 on aix.

thanks
rik
Not tested, but I figure it should work

db2 connect to <source db>
db2 -x "select text || ' @' from syscat.triggers " | tee
my_triggers.ddl
db2 connect to <target db>
db2 -td@ -f triggers.ddl

if you want triggers from specific schema or some other condition you
can add it in the where clause.
Feb 7 '07 #3
On Feb 7, 1:13 am, "Lennart" <Erik.Lennart.J ons...@gmail.co mwrote:
On Feb 7, 4:25 am, "rick" <kantha...@gmai l.comwrote:
Hi
I m new to DB2, Please bear with me if this is silly question, but i
need to know how to copy(only triggers) 400 triggers from one data
base to another on same server and also onto different server.
we use 8.1 on aix.
thanks
rik

Not tested, but I figure it should work

db2 connect to <source db>
db2 -x "select text || ' @' from syscat.triggers " | tee
my_triggers.ddl
db2 connect to <target db>
db2 -td@ -f triggers.ddl

if you want triggers from specific schema or some other condition you
can add it in the where clause.
Thanks Guys

I will try this out.

Feb 7 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2530
by: Mark Flippin | last post by:
I'm just starting to use triggers in my databases and find the support in Enterpise Manager lacking. Using Enterprise Manager and Query Analyzer you can maintain the triggers, but it's cumbersome. Are there better tools for creating and managing triggers? Mark Flippin
1
1825
by: tim.pascoe | last post by:
I'm trying to generate scrips for a database, and everything so far has worked fine, except for the triggers. When I try and script existing triggers, all I get is a blank file - no SQL script. I tried single files for each object, all in one file, triggers only, the entire database. I can't figure it out, but I know the triggers are there. Any suggestions, or am I missing something undocumented in SQL-Server 2000?
4
2713
by: stacdab | last post by:
We have a partitioned view with 4 underlying tables. The view and each of the underlying tables are in seperate databases on the same server. Inserts and deletes on the view work fine. We then add insert and delete triggers to each of the underlying tables. The triggers modify a different set of tables in the same database as the view (different than the underlying table). The problem is those triggers aren't fired when inserting or...
2
1413
by: JA | last post by:
Hi, Newbie here. I have a mailing list program that I really like. I also have a new membership program. The membership program has mailing list signups built-in, but it isn't nearly as robust as the stand-alone mail program. If someone signs up for a newsletter when they register (membership program), can a "trigger" in SQL Server put the same information into the stand-alone program's tables? And when they remove or update their...
5
2433
by: Bruce | last post by:
I have several user defined functions which are referenced in triggers and views. For software upgrades, I need to be able to drop the triggers and views which reference these user defined functions, then drop and recreate the user defined functions, then recreate all the views and triggers. I don't imiagine I'm the first person who needed to do this, and I don't have a lot of db2 experience, so I wanted to see if there is a common or...
0
4913
by: Bruno Lavoie | last post by:
Hello, i'm etablishing a naming convention for a new project under postgresql. For tables, sequences, views, that's ok! I used good naming conventions for this in the past and i'll keep these rules for the new project. but, i plan to use a lot of triggers and functions in this project, but I'm confused! I know that triggers call already created functions. But for tracking i must be able to associate these 2 different object
0
8317
debasisdas
by: debasisdas | last post by:
trigger sample code Ex#10 ======================= INSTEAD OF TRIGGER ---------------------------------------- create or replace trigger mytrig instead of delete or insert or update on eview declare a number(2); begin
0
4489
debasisdas
by: debasisdas | last post by:
This thread contains some useful tips/sample codes regarding TRIGGERS in oracle, that the forum members may find useful. TRIGGERS: =============== Database trigger is a PL/SQL block that is executed on an event in the database. The event is related to a particular data manipulation of a table such as inserting, deleting or updating a row of a table. Triggers may be used : 1.To implement complex business rule, which cannot be...
4
5734
by: --CELKO-- | last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any kind of tools for this?
0
8427
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8332
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2750
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.