Solved

Trigger update on 1st record entered

Posted on 2012-04-08
2
199 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

832 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