BlakeMcKenna
asked on
Automatically create scripts for Tables & Stored Procedures in SQL Server 2008?
I know when making modifications to Tables or SP's, you generally right click on the entity and select Modify. There is also a menu option in the popup menu that says "Script Table as..." or "Script Stored Procedure as..." and then the sub-menu item of "Create In...". When you select "Create In...", it creates an editable SQL script. Is it possible to automate that for each Table/SP rather than doing it one at a time for each one?
Thanks!
Thanks!
What do you mean by automate? Do you want to do this at some interval and save the output in some files? Is it for some kind of source control purpose?
ASKER
Let's say you right click on a Table Object and the menu pops up. You select "Script Table as"/"Create To"/"File". That will produce SQL Code to a file of your choice. Instead of doing that for each object, is there a way to be able to do that for all Objects within a specific Database?
It's essentially scripting out all the Tables, Stored Procedures, etc. into a File, Clibboard, etc.
It's essentially scripting out all the Tables, Stored Procedures, etc. into a File, Clibboard, etc.
ASKER
Hi Jim,
I think I've almost got it. My problem is that there are no other DB's I can choose as a destination and I don't have "Create" privileges to create one.
I think I've almost got it. My problem is that there are no other DB's I can choose as a destination and I don't have "Create" privileges to create one.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Wow...that was awesome!!!!
Thanks so much!
Thanks so much!
>Right Click on the database name > Tasks > Generate Scripts > Next > ...
Very handy... thanks for posting this.
Very handy... thanks for posting this.
ASKER
It sure helped me!!!
Now you can chose which objects you want to be scripted. Just follow the wizard.