Solved

Trigger update on 1st record entered

Posted on 2012-04-08
2
195 Views
Last Modified: 2012-06-27
Hi,

I need to update another table only when the first record is added.
How would I do this?

Thanks
0
Comment
Question by:Sheritlw
2 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 500 total points
ID: 37822515
did you mean of the first record in that table ?
then try this sytas. change the query for update as per your requirmenr

CREATE TRIGGER invUpdate ON [Table_Name]
FOR INSERT
AS
Declare @cnt int



IF Not exists (SELECT * FROM Table_Name)
BEGIN
  Update Another_Table_Name
  set value = value_here_from_inserted_table
  where id  = value_here_from_inserted_table
END


refer
http://www.codeproject.com/Articles/7304/Brief-about-Triggers-in-SQL-Server-2000
0
 

Author Closing Comment

by:Sheritlw
ID: 37846450
Thank you
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

705 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

13 Experts available now in Live!

Get 1:1 Help Now