Generate SQL script to insert XML from files, using Powershell

Posted by Jeff Meatball Yang on Stack Overflow See other posts from Stack Overflow or by Jeff Meatball Yang
Published on 2010-03-22T15:40:13Z Indexed on 2010/03/22 17:21 UTC
Read the original article Hit count: 329

Filed under:
|
|
|

I have a bunch of (50+) XML files in a directory that I would like to insert into a SQL server 2008 table.

How can I create a SQL script from the command prompt or Powershell that will let me insert the files into a simple table with the following schema:

XMLDataFiles (
  xmlFileName varchar(255)
, content xml
)

All I need is for something to generate a script with a bunch of insert statements. Right now, I'm contemplating writing a silly little .NET console app to write the SQL script.

Thanks.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about powershell