vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| An alternative: http://sqlxml.org/faqs.aspx?faq=10 http://msdn.microsoft.com/library/de...ma-mz_2p0r.asp http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=9336 John "Matt Douhan" <matt@fruitsalad.org> wrote in message news:vi8421-q82.ln1@minihopp.internal.hasta.se... > hello > > I have an application where i need to export XML files and put them on a > server share as XML files. > > How can I achieve the XML export part? making the query and such is easy and > exporting as CSV and using BCP is ok, but I really would need to export as > XML files instead of CSV. > > Any ideas? > -- > Matt Douhan > www.fruitsalad.org > matt@fruitsalad.org > *** ping elvis *** > *** elvis is alive *** |
| |||
| > http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=9336 > Trying this approach with the following code exec ('master..xp_cmdshell"bcp "SELECT ar.artnr , ar.artbeskr FROM ar where ar.artnr = 1445 FOR XML RAW" queryout c:\outpath\ups\ups.xml -UXXX -PXXX -c -r -t"') gives me the following error Server: Msg 170, Level 15, State 1, Line 1 Line 1: Incorrect syntax near ' queryout c:\outpath\ups\ups.xml -Usa -P13hla -c -r -t'. I am using SQL2000 and the bcp serion is 8+ Any ideas? Matt |
| ||||
| EXEC master..xp_cmdshell 'bcp "SELECT hasta..ar.artnr , hasta..ar.artbeskr FROM hasta..ar where hasta..ar.itemstatuscode = 210 FOR XML RAW" queryout "c:\outpath\ups\ups.xml" -T -Sbamse -Usa -P13hla -c -r'''' -t''''' this works for me as long as the where clause holds an int datatype, but if I need to single quote a varchar value such as where hasta..ar.artnr = '1440' the it fails, how do I "escape" the '1440' ?? Matt "John Bell" <jbellnewsposts@hotmail.com> wrote in message news:<3f50b7c3$0$10770$afc38c87@news.easynet.co.uk >... > Hi > > This will work. > > EXEC master..xp_cmdshell 'bcp "SELECT OrderId, CustomerId FROM > Northwind..ORDERS where OrderId = 10252 FOR XML RAW" queryout > "c:\outpath\ups\ups.xml" -T -S Server -c -r'''' -t''''', NO_OUTPUT > > You need to specify a fully qualified database name for the table. > The -r and -t options require values (i.e. empty string) > NO_OUTPUT will suppress messages (remove for debugging!) > The directory c:\outpath\ups must exist. > Using quotes around the filename will help with spaces. > > John > > > > "Matt" <matt@fruitsalad.org> wrote in message > news:b609190f.0308300552.4a084f5e@posting.google.c om... > > > http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=9336 > > > > > Trying this approach with the following code > > > > exec ('master..xp_cmdshell"bcp "SELECT ar.artnr , ar.artbeskr FROM ar > > where ar.artnr = 1445 FOR XML RAW" queryout c:\outpath\ups\ups.xml > > -UXXX -PXXX -c -r -t"') > > > > gives me the following error > > > > Server: Msg 170, Level 15, State 1, Line 1 > > Line 1: Incorrect syntax near ' queryout c:\outpath\ups\ups.xml -Usa > > -P13hla -c -r -t'. > > > > > > I am using SQL2000 and the bcp serion is 8+ > > > > Any ideas? > > > > Matt |