Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

db2 question

Posted on 2001-06-20
2
Medium Priority
?
500 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
missionImpossible earned 60 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

618 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