scripting sprocs, tables, views, functions, triggers as individual files
I would like to use github to version control the main objects in my SQL Server 2008 database. I have searched and read many articles and different approaches. There are various utility programs, .NET code, vbscripts, etc. and I realize I can use the "Generate Scripts wizard" from Management Studio.
However, what I would like to do is run a sql script that will do all this for me in one "swoop", and I've found something that is very close: http://weblogs.sqlteam.com/peterl/archive/2008/10/24/How-to-script-out-all-your-objects-one-per-file.aspx
It works fast, efficient and even creates a nice folder structure to put each individual file into. One thing that's really handy is that its easy to modify to only select objects with a certain prefix only. It is almost perfect!
So in a perfect world I would love some help to get the script to do two more things:
- include tables to be scripted
- figure out how it will write the files to my local machine even though i'm connecting from my local machine to a remote machine.
As I said, this script is great minus the two issues above that would solve all my issues. It would then make it easy to run the script after a workday, have it generate each object as a file into开发者_开发技巧 a folder on my local machine that is watched by git, then check differences into github.
Hope this question is understandable :)
Thanks in advance for any help!
Did you check out red-gate sql server source control? It fits right into SSMS, and is a breeze to use.... we use it and it works perfectly....
http://www.red-gate.com/products/sql-development/sql-source-control/
精彩评论