SQL: BCP Eporting and XML Importing

Post on 23-Feb-2017

280 views 0 download

Transcript of SQL: BCP Eporting and XML Importing

XML Exporting and Importing

Presentation by Aaron BumaDevelopment DBA

Exporting Using BCP

• BCP: Bulk Copy Program– Give a SQL statement, Get a file with results

• Access from Command Prompt/Powershell

• 1) BCP “Statement” queryout {file location} {username/password/Trusted} {Server}

Importing XML from a file

• Use OPENROWSET() to pull file into memory

• Use OPENXML to point to the file and shred

DEMO

Review• BCP data from database to file• OPENROWSET and OPENXML to pull XML out of file

Presentation Recording, Slides and Scripts– Available at:

http://www.aaronbuma.com/category/sql-training/– Contact:

Email: Aaron@AaronBuma.com