Learn more about SQL Server tools

mssqltips logo

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Scripts          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories


SQL Server Video to Pre-Validate Data with PowerShell Before Importing

By:   |   Last Updated: 2014-07-29   |   Comments   |   Related Tips: More > Import and Export


Enter your business email address to
get free SQL Server tips.

Problem / Solution

One issue with importing data into SQL Server is that the import file has rows that have too many or too few columns and therefore the imported data doesn't insert correctly or doesn't import at all.  With small files this is easy to manually correct prior to import, but what about files with thousand or millions of rows?  In this video tip, we look at how to use PowerShell to remove the bad records so the import process can function without issue.

Key Learning Items
  • The import behavior of BULK INSERT when there are too few or too many delimiters in a line.
  • PowerShell script to automate removing invalid lines.
  • Reminder of why logging good data is important.
Read Companion Tip

Click Here

Last Updated: 2014-07-29

get scripts

next tip button

About the author
MSSQLTips author Tim Smith Tim Smith works as a DBA and developer and also teaches Automating ETL on Udemy.

View all my tips

Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Email me updates 

Signup for our newsletter
 I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.


Learn more about SQL Server tools