Fixing column names when importing CSV using SSMS

SSMS provides a handy import tool for CSV flat files. I've been having to do some one-off work pulling data out of Powershell for insert into a local database for analysis, and the CSV files are filled with double quotes by design. SSMS import data builds a rudimentary SSIS package and slaps columns over quickly. If it encounters unsupported characters like double quotes, it converts them to underscores. You can tediously fix this in your package definition, but the UI is cumbersome and a hindrance. I wrote this quicky script to allow you to accept the defaults and simply run a SQL script afterwards for cleanup!


Note - this script creates a script for you to run. I try not to post anything on a blog that would actually perform a potentially breaking change :)

Comments