This post is a continuation of the previous post, Part 2.
While the code in Part 2 works, it would be better if we added some error trapping. What if the user of the program deleted the source file, renamed the source file, or the source file is empty? What if the format of the data inside the file was changed? What if new data was added to the file, data that we want to import? This topic is often referred to as exception handling.
Please have a look at the continuation of this post series as it merges into the series on Exception Handling. The post is called SQL Server Exception Handling Part 8.