Generating bulk SQL data scripts

Most web developers who develop Asp.Net web applications come across SQL Server. While developers may have less direct contact with databases than before due to ORM (object-relational mapping) tools, most of us still work with databases on a regular basis. Today was one of those days, I was faced with generating a couple of large SQL data export scripts.  These scripts have to be executed by a service provider, and since I don’t have access to their machines delivering scripts is the only simple way.

There are many tools for generating large SQL data export scripts, but not all are suited for managing large/bulk scripts. SQL data compare, a tool by Red Gate, generates scripts that are rather large, without an option to split the generated script. Since SQL data compare was my only tool for managing SQL data, I had to search for additional tooling, and i found the wonderful BCP utility.

It turns out the BCP utility is included in the SQL server install, and its specifically made for dealing with large bulk exports and imports. Its old school command-line, which might not make it the most user-friendly tool, but damn, is it fast. And it’s available on every machine that has SQL server installed. The basic usage of the BCP utility is clearly explained in this article, it’s pretty straightforward and the tool is awesome so use it! That is all, happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>