Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help on trigger

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I want to generate a text file when changes are made to a table. I wrote a trigger like this. If put any statements otherthan bcp statement it is working fine. Bcp statment is working fine in query analyzer. If i put the same in trigger query is not coming out after 5 minutes also and i am not able to access the table too.

create trigger gentextfile on region
for insert, update
as
exec master..xp_cmdshell 'bcp "select * from northwind..region" queryout c:\region.txt -c -Soffice -Usa -P'

Let me know if any other alternative is there.
 
Are you checking C:\Region.txt on your server, or workstation?

Running the exec statement within Query analyser will copy the file down to your local C: drive, but execution through a trigger will always copy down to the C: drive of the server that you are using.

 
Hi ChrisSharratt

Thanks for the suggestion. I am working on the server itself. so I feel it is not the problem. The problem is the query is executing continuously till we kill the process, once if i update the trigger.

 
Hi ChrisSharratt

Thanks for the suggestion. I am working on the server itself. so I feel it is not the problem. The problem is the query is executing continuously till we kill the process, once if i update the trigger.

chpnmurty@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top