Solved

db2 question

Posted on 2001-06-20
2
438 Views
Last Modified: 2012-05-04
Hai all,

We are using DB2 database as our backend database. In this database i have a table that contains three columns.
First column is name of type varchar,
Second column is phnumber of type varchar,
Third Column is ctime of type timestamp.
With this table i want to insert persons name and phone number through the program which i am using and the third field has to be updated with the current time stamp automatically. I know to insert first two columns.I know it is possible with TRIGGERS.but i dont know how to use triggers.i am very new to TRIGGERS.
Please help me out with this regard.

thanks

bye.

0
Comment
Question by:naga1979
2 Comments
 
LVL 2

Accepted Solution

by:
missionImpossible earned 20 total points
ID: 6209507
CREATE TRIGGER TriggerName AFTER insert ON yourTable REFERENCING OLD AS inserted FOR
EACH ROW MODE DB2SQL  BEGIN ATOMIC UPDATE yourTable SET ctime = CURRENT TIMESTAMP where name = inserted.name; END



For general syntax of triggers show in IBM-DB2-helpsystem
0
 
LVL 1

Author Comment

by:naga1979
ID: 6325493
Thanks

Cheers
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Database tuning – How to start and what to tune. This question is frequently asked by many people, both online and offline. There is no hard and fast rule-of-thumb for performance tuning, however, before beginning the tuning process one should a…
I guess that all of us know that caching the data usually increase the performance, but I worried if all of us are aware about the risk that caching the data provides and how to minimize this.  That’s the reason why I decided to write this short art…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now