Posts Tagged ‘export’

Exporting data from SQL to XML

Written by Ingmar Verheij on May 8th, 2010. Posted in Batch

Exporting data from a SQL database to a XML file is very easy, if you know how to.
Using the bcp command (bulk copy program), a tool supplied by Microsoft, you can easily export all the data you want.
– Create a new text file and type the following text:

<root>
</root>

– Save the text file with a .xml extension, for instance data.xml;
– Open a new Command Prompt (as Administrator in Vista/Win7/2008 R2);
– Execute the following command : bcp.exe “SELECT * FROM Table AS XML RAW” queryout data.xml -c -r -t -T.
If you want to script the process with batch (we’re a big fan of batch files) you can use the following script:

@Echo Off

REM Create an empty XML file
ECHO ^<root^> >data.xml
ECHO ^</root^> >>data.xml
REM Export the data using BCP
bcp.exe "SELECT * FROM Table AS XML RAW" queryout data.xml -c -r -t -T.

Ingmar Verheij & Daniel Nikolic

Encrypted pages (HTTPS / SSL) are unable to export to local applications

Written by Ingmar Verheij on November 4th, 2009. Posted in Internet Explorer

Internet based applications can be used to export content to a local application. Usually this is done by exporting the content to a format which is commonly used, like .PDF (Adobe Reader), .XLS (Microsoft Excel) or .DOC (Microsoft Word).

When the data is exported the user is confronted with a dialog which allows the user to open or save the document. In this dialog the content type is already shown (because of the file type association), an indication most of the tasks are processed in a correct order. The dialog could look like this (in dutch):
Right result

Donate