SQL Data Compare

Latest version: 10.0

SQL Data Compare

Knowledge Base

Running migration scripts using SqlCmd.exe

Category: Troubleshooting & error messages
Date: 05 Jun 2009
Product: SQL Data Compare
Microsoft provide a command-line utility called SqlCmd.exe with SQL Server 2005 and up, 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 whilst 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:

http://www.red-gate.com/MessageBoard/viewtopic.php?t=8109

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

Document ID: KB200906000390 Keywords: Data, Compare, large, sql, scripts

Was this article helpful?

Search support
Forums

SQL Data Compare

all SQL products

all products