Prabhu
Prabhu

Reputation: 13335

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).

Upvotes: 3

Views: 8271

Answers (6)

Stef Heyenrath
Stef Heyenrath

Reputation: 9830

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

  • Stored Procedures
  • Functions
  • Views
  • Triggers

Upvotes: 0

user2036876
user2036876

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

iDevlop
iDevlop

Reputation: 25262

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

Upvotes: 0

Nick Vaccaro
Nick Vaccaro

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

HLGEM
HLGEM

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

kemiller2002
kemiller2002

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

Related Questions