?
Solved

Write Trigger to Print Inserted Records

Posted on 2005-03-08
5
Medium Priority
?
325 Views
Last Modified: 2008-02-01
Hi,
I have a stored procedure which INSERTS BULK RECORDS into a Table using OpenXML approach

Now I would like to write a trigger on the same table to Print out all the inserted records
Looping thru the inserted Table in Trigger..

Considering Table -- Customer    and bulk rows inserted in columns Customer_ID,Customer_Name

can example be shown?
0
Comment
Question by:sainavya1215
  • 3
5 Comments
 
LVL 10

Expert Comment

by:RichardCorrie
ID: 13486342
Print Out ???

You cannot print from a trigger (whatever you mean by "Print")

/Richard
0
 

Author Comment

by:sainavya1215
ID: 13488023
Well if u insert Bulk records in sql query analyzer and we have a trigger being fired on same table which has print statements then we can see in query analyzer
0
 

Author Comment

by:sainavya1215
ID: 13488062
ok let me put it in this way :

all the Inserted records(ie bulk Insert) into customer Table (with columns  customer_ID,CustomerName)

...Now the trigger is fired on the customer Table and all the inserted records should be inserted into a different table known as History with the same columns Customer_id,customerName........

Lets consider this
0
 
LVL 4

Accepted Solution

by:
strangelynormal1 earned 1400 total points
ID: 13490359
CREATE TRIGGER INSERT_customerID on [customer Table]
FOR INSERT
AS
INSERT  History
SELECT *
FROM Inserted
0
 

Author Comment

by:sainavya1215
ID: 13493988
Thx
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

621 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