Committing a sproc change with command line

A SQL Server Management Studio add-in to source control your database in Subversion or Team Foundation Server.

Moderators: Chris Auckland, David Atkinson, sherr, PhilScrace, andy.campbell.smith

Committing a sproc change with command line

Postby lkeith » Tue Aug 21, 2012 6:01 pm

I have made a change to an sproc in a db not linked to source control (but I could if necessary).

I would like to commit the sproc change to source control using a command line interface.

Is this possible and if so, what can I do?
lkeith
lkeith
 
Posts: 6
Joined: Tue Aug 21, 2012 5:48 pm

Postby David Atkinson » Tue Aug 21, 2012 9:25 pm

Yes, you can use the command line to do this.

more info here:
http://www.red-gate.com/supportcenter/c ... _in_the_cl

use /db1 and /server1 to specify the source
use /scripts2 to specify the target
use /sync to sync to the scripts

And use your source control command line tool to commit to your repository. You'll have to consult the source control tool's documentation to achieve this.

Why is it that you wish to do this?

David Atkinson
Red Gate
David Atkinson
 
Posts: 1124
Joined: Mon Dec 05, 2005 4:54 pm
Location: Twitter: @dtabase

Postby lkeith » Tue Aug 21, 2012 9:28 pm

I want to do this because I am making a change to an SP from a custom utility outside the usual source control and want to commit it to source control so everyone will get the changes.
lkeith
lkeith
 
Posts: 6
Joined: Tue Aug 21, 2012 5:48 pm

Postby David Atkinson » Tue Aug 21, 2012 9:30 pm

Please give it a go and let us know how you get on. There's no reason why it shouldn't work, although it isn't something that we're asked very often!
David Atkinson
 
Posts: 1124
Joined: Mon Dec 05, 2005 4:54 pm
Location: Twitter: @dtabase

Postby lkeith » Wed Aug 22, 2012 3:47 pm

Thanks, David! Everything worked great. Now instead of modifying the sproc file in the repository and comitting to source control, I changed the SP in the DB then used SQLCompare to move the changes to the scripts repository then simply comitting to source control! Much more straigtforward.

SQLCompare adds some SQL directives at beginning & end of all sproc scripts and all scripts are CREATE, not ALTER. I had to manually add this to each script I put in the repository. Now I don't have to do that since SQLCompare will now.

Thanks again!
lkeith
lkeith
 
Posts: 6
Joined: Tue Aug 21, 2012 5:48 pm


Return to SQL Source Control 3

Who is online

Users browsing this forum: No registered users and 1 guest