Reputation: 13335
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).
Upvotes: 3
Views: 8271
Reputation: 9830
You can also check out MyDbUtils which can create scripts for:
Upvotes: 0
Reputation:
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#)
Upvotes: 1
Reputation: 25262
Have a look at these:
WinSQL (Lite edition is free, other versions are reasonably priced + free trial)
OpenDbDiff (free)
Upvotes: 0
Reputation: 5504
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.
Upvotes: 4
Reputation: 96572
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.
Upvotes: 2
Reputation: 115488
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.)
Upvotes: 1