Red Gate forums :: View topic - Diff script using sql compare command line
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Compare 10
SQL Compare 10 forum

Diff script using sql compare command line

Search in SQL Compare 10 forum
Post new topic   Reply to topic
Jump to:  
Author Message
ax4413



Joined: 03 Dec 2013
Posts: 5

PostPosted: Tue Dec 03, 2013 10:20 am    Post subject: Diff script using sql compare command line Reply with quote

Is it possible to create a diff script using sql compare command line?

I want to create a upgrade script using sql compare command line for use in our CI process. I cant seem to get it to work. Are there any examples of how to do this. It only seems possible to use the \synchronize switch. This is not what i want to do, I want to generate scripts that can be run.

I am presently evaluating the tools and this will be a deal breaker for us if we cant generate scripts..

Any help would be greatly appreciated.
Back to top
View user's profile Send private message
David Atkinson



Joined: 05 Dec 2005
Posts: 1123
Location: Twitter: @dtabase

PostPosted: Tue Dec 03, 2013 10:51 am    Post subject: Reply with quote

I think you're looking for /ScriptFile

sqlcompare /db1:WidgetStaging /db2:WidgetProduction
/scriptFile: "C:\Scripts Folder\WidgetSyncScript.sql"

It's described in more detail here:

http://www.red-gate.com/supportcenter/Content/SQL_Compare/help/10.2/sc_cl_Switches_in_the_cl
Back to top
View user's profile Send private message Send e-mail
ax4413



Joined: 03 Dec 2013
Posts: 5

PostPosted: Tue Dec 03, 2013 11:31 am    Post subject: Reply with quote

Thank you David Atkinson,

I had previously been trying to use the /MakeScripts switch which was wrong, all i need to do was use the /ScriptFile switch.

Can I ask one other question?

This is a question to do with migration scripts. I am using the below command, but this does not seem to be picking up the migration scripts that I have generated.

sqlcompare.exe
/include="Identical"
/include="StaticData"
/scripts1="C:\SVN\Code\trunk\Databases\Test1\Database"
/migrationsfolder:"C:\SVN\Code\trunk\Databases\Test1\DatabaseMigration"
/scriptsfolderxml:"C:\SVN\RedgateBuild"
/db2:Target
/scriptFile:"C:\SVN\Output\DiffScript.sql"


Scripts1 is the location of my database source control
MigrationsFolder is the location of the migrations folder associated with source control
ScriptsFolderXML is a folder I created which contains a xml file I generated following your advice in post http://www.red-gate.com/MessageBoard/viewtopic.php?t=14941

Can you offer any advice?
I can create a new post if that helps.

Thanks in advance
Back to top
View user's profile Send private message
ax4413



Joined: 03 Dec 2013
Posts: 5

PostPosted: Tue Dec 03, 2013 4:06 pm    Post subject: Closed Reply with quote

I have resolved the issue my self. I use the following command.

sqlcompare.exe
/include="Identical"
/include="StaticData"
/sourcecontrol1
/revision1:HEAD
/scriptsfolderxml:"C:\ScriptFolderLocation.xml"
/migrationfolderxml:"C:\MigrationFolderLocation.xml"
/server2="localhost"
/database2="Target"
/scriptFile:"C:\SVN\Output\Diff.sql"
/verbose

Where scriptsfolderxml points to an xml file path which defines the script folder. see below:

<?xml version="1.0" encoding="utf-16" standalone="yes"?>
<ISOCCompareLocation version="1" type="SvnLocation">
<RepositoryUrl>file:///C:/SVN/SVNRepository/trunk/Databases/Test1/Database/</RepositoryUrl>
</ISOCCompareLocation>

Where migrationfolderxml points to an xml file path which defines the script folder. see below:

<?xml version="1.0" encoding="utf-16" standalone="yes"?>
<ISOCCompareLocation version="1" type="SvnLocation">
<RepositoryUrl>file:///C:/SVN/SVNRepository/trunk/Databases/Test1/DatabaseMigration/</RepositoryUrl>
</ISOCCompareLocation>

These files were generated by myself, they do not exist as part of source control.

Hope this helps someone else.
Back to top
View user's profile Send private message
David Atkinson



Joined: 05 Dec 2005
Posts: 1123
Location: Twitter: @dtabase

PostPosted: Tue Dec 03, 2013 4:16 pm    Post subject: Reply with quote

We are moving towards an improved migration script approach, which you might want to take a look at:

http://www.red-gate.com/products/sql-development/sql-source-control/entrypage/sql-source-control-migrations-beta

This doesn't rely on the command line being able to talk back to your version control system at compare time, so is more robust generally. Would you be able to take a look and see if works for you?
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group