Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 11th, 2006, 12:02 PM
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Question for Trigger

I'm new at triggers and I have to create one.
The scenario is:

There is one table T1 and it has its primary key as ID which is autogenerated by Identity. I want a trigger Insert, it should fire, once I do the insert on T1, it should also insert some columns to T2. I also need tht identity column value. How should I do this?

Thanks for all your help.

Reply With Quote
  #2 (permalink)  
Old December 13th, 2006, 08:30 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...
this is for SQL server?

HTH

Gonzalo
Reply With Quote
  #3 (permalink)  
Old March 1st, 2007, 06:45 AM
Authorized User
 
Join Date: Mar 2007
Location: New Delhi, Delhi, India.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If U r using SQL Server then....
You can Get all the information about the record just inserted from INSERTED Table, This is a Temporary System Table used to hold the row for Last insertion and can be queried as u do with user created table, It has the structure of the table u r inserting row in.

If U r using ORACLE Db then....
There two bind variables 1- :new and 2- :old
both holds new & old values respectively.

U can use these variables as...
:new.<columnName>
:old.<columnName>


Akhil
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trigger question for columns with text in MS sql s robtay SQL Server 2000 1 November 12th, 2006 03:21 PM
Trigger aware SQL Server 2000 1 April 15th, 2005 01:28 PM
do I need a trigger? Warbird SQL Server 2000 1 April 5th, 2005 08:07 AM
Using instead of trigger dmr999 SQL Server 2000 1 November 29th, 2003 02:35 PM
trigger khautinh SQL Server 2000 5 October 16th, 2003 11:33 AM



All times are GMT -4. The time now is 09:39 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.