I need to create Insert scripts from the content of a table. To do that, I used the database tasks -> generate scripts.

The table is quite big and in the generated script, it adds PRINT command after each 100 number of rows and a GO statement. For example:

print 'Processed 9200 total records'

For some reasons I can't have GO and PRINT command in the script, repeated in the middle. Is there any way to avoid creating them in the generated script? It is really time consuming to go one by one and delete all PRINT xxxx statements.



I would not remove the GO statements that break up large batches. There are various reasons for breaking large inserts

  1. size (duration) of transactions
  2. memory requirements
  3. transaction log management
  4. mirror synchronicity
  5. error isolation (by batch)
  6. etc...

As for removing the status updates, that can be done easily. Press Ctrl-H or from the menu, Edit -> Find and Replace -> Quick Replace, fill it in as shown in the image below making sure to tick "Use" Regular Expressions, then click on "Replace All" to zap them all.

Remove PRINT updates


You can also remove the PRINT command from the generate scripts wizard by setting "Include Descriptive Headers" to false.

Generate SQL Server Scripts Wizard (Choose Script Options Page)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.