Trying to export XML data to an XML file. Using a T-SQL trigger script.Using this code seems to write the file to the proper destination but it is empty and SQL seems to hang. If I try to execute another script against the database, they just sit there saying.... executing query....Been fighting this for an hour or more. Hope I can get an assist here.If I go to DOS and execute the commandbcp 'select xmlContent from ProcureToPay.dbo.XmlOutFiles" queryout C:\Temp\OrderNo_123.xml -w -x -T -SSqlServerThat functions but i need the code to execute reliably as T-SQL triggers. Any assist appreciated.Environment: Running script tests from a workstation on the network, SQL server on another machine.Declare @cmd varchar(500), @dest varchar(100)Select @dest = (Select filename from xmlOutfiles) -- it has C:\Temp\OrderNo_123.xml in filenameSelect @cmd = 'bcp "select xmlContent from ProcureToPay.dbo.XmlOutFiles" queryout '+ @dest + ' -w -x -T -S' + @@servernameExec xp_cmdshell @cmd
↧