?
Solved

Write Trigger to Print Inserted Records

Posted on 2005-03-08
5
Medium Priority
?
321 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
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.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Suggested Courses

765 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