Solved

db2 question

Posted on 2001-06-20
2
423 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
Comment Utility
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
Comment Utility
Thanks

Cheers
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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…

763 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

11 Experts available now in Live!

Get 1:1 Help Now