I have created a SQL Trigger as below.
create trigger testtrigger on testdb
declare @sql varchar(8000)
SELECT @sql = 'bcp "select * from testdb" queryout c:\output.txt -c -t -T -S localhost'
exec xp_cmdshell @sql
But when a row inserted in the testdb, the text file is created, but there is no content. Can someone please help me to resolve this.