Sql Server Script Generator

Is there a tool that will let me generate a single script containing all tables and views? Sql Publishing Wizard drops everything (so all data is lost) and recreates it. It does have an option to not drop, but in that case, it doesn't update tables that exist (if any columns have changed).

0

6 Answers

In SQL Server Management Studio 2008 you can right-click on a database in the object explorer, go to Tasks > Generate Scripts..., and that will give you the option to choose not only what object types you want to script, but whether or not you want to script the drop as well.

1

When you are making changes to existing tables, you should be writing alter table scripts to make the change and then putting them in source control like any other code. Then when you deploy a set of changes, you run the scripts you created for that deployment.

Otherwise, yes use SQL compare.

Should you look at the Red Gate products specifically SQL Compare. They'll handle any situation you could need concerning script generation and database synchronization. (You can get a trial license too, to try it out and see if it is what you need.)

1

Have a look at this tool can be used which has the capability to generate the create and drop scripts for the SQL server objects, provided in a configuration file.

This tool uses the same mechanism as SSMS tool uses to generate the script.

SQL Server Script Generator Tool (via C#)

Have a look at these:
WinSQL (Lite edition is free, other versions are reasonably priced + free trial)
OpenDbDiff (free)

You can also check out MyDbUtils which can create scripts for:

  • Stored Procedures
  • Functions
  • Views
  • Triggers

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like