Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trigger - Insert Values

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,

I have a main table CONTACT with a counter as the key. I want to write a trigger that, everytime a row is created in this main table CONTACT, a new row is inserted in an annex table with the number generated as the value of a column.

For example, if the following row is inserted in the main table CONTACT:

Generated number
|
v
22 John Smith

So a trigger insert the following row in another table:

22 2001/06/18

Is it possible ? How ?

Thanks

Vincent
 
The MS SQl Server syntax is...

Create Trigger trgInsertAnnexRow On tbl For Insert As

Insert AnnexTbl (RecID, InsertDateTime)
Select RecID, getdate() From inserted


Terry

The reason why worry kills more people than work is that more people worry than work. - Robert Frost
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top