SQL Trigger to create .csv file

0 pts.
Tags:
SQL
SQL Server
SQL Server 2000
I need to create a .csv file out of table A upon the insertion of a record into table B. It seems to me that this should be easy to accomplish, but the only answer I can get from anyone is to do a scheduled DTS package, which means we are dumping this table every couple of minutes all throughout the day. How do I build a trigger that would accomplish this?
ASKED: March 24, 2005  2:32 PM
UPDATED: March 30, 2005  7:37 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

I have been able to create a DTS package using T-SQL. I think I found how to do it in BOL or maybe a technical bulletin. Then you can create an after insert trigger on table B that calls a stored procedure that builds a one time dts package. This may not work very well if there are alot of insert hits on the table. Be sure to only execute the after insert when a set of records is inserted, not for each row.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Fanbot
    Zannemarie, you state that you require a .csv file to be created from table A after insertion of a record into table B. Therefore every time you insert a record into B a .csv will be created from A when applying a trigger. Reading further it appears that you do not wish to have table A dumped (.csv created) every time a record is inserted in B. Could you explain your process in a little more detail i.e is the .csv to be created once a day or only on insertion of a special type of record in file B? Let us know Fanbot
    0 pointsBadges:
    report
  • Zannemarie
    Actually, I really -do- want to create the .csv file out of table A every time we insert a record into table B. That's how we figured it would be easiest for the client to trigger the event. So the only time there would be an insert, would be when the client clicked the link, inserting the record with their loginname and date/time. Does that make it easier?
    0 pointsBadges:
    report
  • Fanbot
    Zannemarie, As the the first reply stated, use a trigger AFTER INSERT of a record into file B to call your procedure to create the .csv file from file A. However, if you have multiple inserts from various clients (file B)and you only wish to create a .csv under certain conditions, evaluate the the trigger data from file B prior to building the .csv. Hope this helps.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following