Running large MSSQL scripts & resulting memory errors

One of the greatest free tools to come from Microsoft in the last couple of years in my opinion is the Database Publishing Wizard. It generates a single .sql script for your entire database – schema and data together. This is a god send, as quite often when working with a non-dedicated server you can have very limited access to the database itself (sometimes just a web interface) and this allows you to run one script command and you on your way – too easy.

Usually you do this when you deploy the first time, and the database is quite small in size so its not an issue – but what if your using it as a way to bring the data back or copy it between two sites. This seems silly but as many of you may know that sometimes bad things happen to good people – this was one of these days.

 

Solution:

Using SQLCommand from command promt

sqlcmd -S YOURSQLSERVER\INSTANCENAME -i “C:\Script.sql”

Reference from Diary of a Ninja

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s