Munish Goyal
Munish Goyal

Reputation: 1409

Generating SQL change scripts in SSMS 2008

I have gone through many related SO threads and got some basic info.

Already generated DB diagram.

After that i am unable to find a button/option to generate SQL scripts (create) for all the tables in diagram.

"Generate script" button is disabled, even on clicking the table in diagram.

However i enabled the auto-generate option in tools->designer. But what to do with previous diagrams.

I just want an easy way to auto-generate such scripts (create/alter) and would be gud if i get auto-generated stored procs for insert/selects/update etc.

EDIT: I could do generate scripts for DB objects.

Now: 1. How to import DB diagram from another DB. 2. How to generate (and manage their change integrated with VS source control) routine stored-procs like insert, update and select.

Ok let me ask another way, can experts guide on the usual flow of creating/altering tables (across releases), creating stored-procs (are stored-procs the best way to go ?) and their change-management using SSMS design tools and minimal effort ?

Upvotes: 0

Views: 1124

Answers (1)

marc_s
marc_s

Reputation: 754468

You can go to the Object Explorer in SSMS, and right-click on your own database, and then pick "Tasks" > "Generate Scripts" to generate a whole bunch of scripts for your database.

Mind you - this is just a single set of CREATE statements, basically.

alt text

If you're using the visual table designer to modify your tables, you can also have it create a script to handle the changes you've made.

And in Visual Studio 2010 Professional or up, you can also take snapshots of databases, and compare two sets of your database and generate ALTER scripts from those .

Upvotes: 2

Related Questions