0

I am invoking sqlcmd as follows:

sqlcmd -S SERVERNAME\SQLEXPRESS -i "C:\Documents and Settings\user\Desktop\data\bigDB.sql"

And I get an error while the script is executing:

Sqlcmd: Error: Syntax error at line 86626 near command '%' in file 'C:\Documents
 and Settings\user\Desktop\data\bigDB.sql'.

How do I tell sqlcmd to ignore the current record and keep running? I think i could edit bigDB.sql and include an :On Error Ignore directive at the top - but the bigDB.sql file is 5GB is size - i cant edit.

Or How could I go to the specific line and delete out the bad record? Thanks for helping.

Utpal Mattoo
  • 890
  • 3
  • 17
  • 41
  • You could edit bigdb.sql with an editor that does not read the whole file into memory. Maybe UltraEdit. – joshp Jul 23 '12 at 21:15
  • UltraEdit is helpful but sqlcmd thinks there are syntax errors in the .sql script file (auto generated using SSMS) and stalls repeatedly. Is there another utility in SQL Server which, for example, does not care about a '%' in the inserted column value and carried on with the script execution? – Utpal Mattoo Jul 24 '12 at 13:47
  • See my comment in your other question: the issue here is not sqlcmd, it's how you manage source code and deployment. And if you can just delete "bad" records without affecting your script, why are those records needed in the first place? – Pondlife Jul 27 '12 at 20:47
  • It would be better to fix the problem with SSMS when it generates the script than to ignore statements with a '%' in them. Isn't the real question how to make SSMS script runnable insert statements when the data contains a '%'? – James L. Jul 27 '12 at 20:54

0 Answers0