February 3, 2009 at 1:32 am
if I change a table definiton in Management Studio, it creates a script, that makes a temp table, fills it with data, deletes original table and renames the temp table. All constraints, triggers, grants, etc. are preserved. How can I generate such a script for all tables in the database?
It has the following background: I need to change a certain column in every table to identity, preserving column sequence.
February 3, 2009 at 1:00 pm
[font="Verdana"]Me, I'd do this by writing a script that writes the script (by querying the SQL Server meta-data.)
If you don't know what you're doing there, perhaps there's a better solution.
Right click on the database in Management Studio, then go to Tasks and Generate Scripts...
This pulls up a wizard. Step through the wizard, and generate a script for all of the objects in your database. At that point, you can work your way through the script and add in the parts to change the objects as you wish. Use the data change script generated earlier as a template.
[/font]
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply