SQL Data Compare 11

Running migration scripts using SqlCmd.exe

Microsoft provides a command-line utility called SqlCmd.exe with SQL Server 2005 and later, but this utility will not run a SQL script over 500MB in size, and will return the following when this condition is encountered:

Sqlcmd: Error: Scripting error

The way around this is to switch off transactions while doing SQL Data Compare and obtain the script in the usual way. You then have to parse the script in an application, written in, for example, Visual Basic or Perl that will divide the queries into smaller batches. As you will not have any transactional integrity you will have to take a backup before you attempt to run the migration SQL script. 

The following example contains VB script that injects a "GO" every 100 lines:


Other workarounds might be to use a WHERE clause to restrict the amount of data being deployed, or to select fewer objects for the deployment and then run several deployments.

Didn't find what you were looking for?