Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQL Server Central Webinar Series #5: Setup Your Source Control With Help from PowerShell Expand / Collapse
Author
Message
Posted Tuesday, November 9, 2010 9:20 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, July 15, 2008 7:24 AM
Points: 0, Visits: 0
Comments posted to this topic are about the item SQL Server Central Webinar Series #5: Setup Your Source Control With Help from PowerShell
Post #1018361
Posted Monday, December 13, 2010 8:50 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 18, 2014 8:01 AM
Points: 258, Visits: 701
Keep in mind Red Gate has a wonderful tool, Sql Compare and if you have the professional edition it comes with a command-line utility, sqlcompare.exe (I'm not sure why you use SQL Source Control without it!).

Anyways here's one-liner to script out all of your database objects (one file per object) with a folder structure of Tables, Stored Procedures, Views--i.e. the kind of structure you'd expect to check into source control:

sqlcompare.exe /s1 "MyServer" /db1 "MyDb" /mkscr:"C:\Scripts"

I'm a big PowerShell fan, but sometimes it just makes sense to purchase/use an existing tool. You can always wrap PowerShell scripts around the tool as needed.



Post #1033862
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse