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.
Using SQLCommand from command promt
sqlcmd -S YOURSQLSERVER\INSTANCENAME -i “C:\Script.sql”
Reference from Diary of a Ninja