Reputation: 58595
Every time I want to create a script of the database structure (and data) of our deployment database (a brand new database with the software's basic data), I have go to SSMS, select the database, Tasks -> Scripts -> Generate Scripts. Then I have a very specific setting which I have to change every single time to the same values.
This is very time consuming and looks like a task that could very well be automated. Is it possible to automate this task from within SSMS, with my specific settings? If not, is there a way to automate it outside SSMS? I do not discard writing a C# console program to perform that, this task is not for the final user it's for our labs.
UPDATE
The objective here, as usual, is getting the solution which will take less time. So, before I got to the C# coding level, I would like to try automating the existing tools. The order would be:
Upvotes: 1
Views: 499
Reputation: 388
What are you using the script for? (I can think of backup, release versioning, source control for logging each change)
Upvotes: 2
Reputation: 74177
Look at SMO: http://msdn.microsoft.com/en-us/library/ms162169(v=SQL.100).aspx
Then script your database, put the scripts in source control and require that changes be made via scripts.
Upvotes: 0