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 Validate File Properties Prior to Importing Data

By:   |   Last Updated: 2014-07-07   |   Comments   |   Related Tips: More > PowerShell


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

Problem / Solution

Sometimes we need to import a file only after we know that it's the right size or the right length. If the file falls short of a certain length or size, it may be because the file doesn't contain all the data or is in a corrupt state. By adding a measure to check the size and length prior to importing we can prevent data problems. In this video, we will look at how to check the number of rows and the file size using two different methods. This video will show how you can incorporate pre-import checks to your processing using either PowerShell or C# code.

Key Learning Items

  • Verify length in PowerShell.
  • Verify size in PowerShell (MB or GB).
  • Verify length in C#.
  • Verify size in C# (MB or GB).

Read Companion Tip
Click Here

Last Updated: 2014-07-07

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
Related Resources

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