SQL Server Video Validate File Properties Prior to Importing Data


By:   |   Updated: 2014-07-07   |   Comments   |   Related: 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





Comments For This Article





download





Recommended Reading

Setting the PowerShell Execution Policy

How to find a specific text string in a SQL Server Stored Procedure, Function, View or Trigger

Using PowerShell to Work with Directories and Files

Bulk Copy Data from Oracle to SQL Server

Execute SQL Server Stored Procedures from PowerShell








get free sql tips
agree to terms


Learn more about SQL Server tools