Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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'
GO

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.

Thanks.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

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

share|improve this answer

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)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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