![]() To compare two databases, we can use the following general syntax: Open the file in a browser to see very nice documentation of the command line tool of SQL Compare.įigure 2 Compare schemas of two databases > sqlcompare /? /v /htmlĮxecuting the above command produces a very long string of HTML text in the console window, but if we use the /out switch, we can write the file directly to the disk system, as follows: > sqlcompare /? /v /html /out "c:\temp\SCHelp.html" The former enables more detailed information about the sqlcompare.exe options, and the latter outputs the Help documentation to HTML (although it would be nice if this HTML file were already in the installation directory of SQL Compare). Simply open a command line and navigate to that directory, in my case as follows: C:\> cd\Program Files (x86)\Red Gate\SQL Compare 12 Reviewing command line parameters and documentationįrom the installation directory, a good starting point is to bring up the sqlcompare help screen: > sqlcompare /?Ī couple of interesting switches are /verbose and /html. You can find the executable file, SQLCompare.exe, in the installation directory of SQL Compare. Where to find the command line executable For full details, see the Changes to distribution of command line page of the documentation. I’ll be focusing on simple command line execution with a batch script, but see also Automating Schema Comparisons with SQL Compare Projects and PowerShell.Īutomations that use SQL Compare command line on a machine that is the ‘server’ (such as a Build or CI Server) in a deployment pipeline need Redgate Deploy or SQL Toolbelt licenses. SQL Compare’s command line interface allows access to all the functionality of the UI tool, and allows us to introduce automation and scheduling, for example by invoking the command line from a batch file or PowerShell script, and then perhaps executing the script as a scheduled Agent job. Getting started with automating database schema comparisons My example compares the schema of two live databases, but you can equally well run the comparisons using scripts folders, or SQL Compare Snapshots. This article is not intended as a tutorial on the various command line switches, options and filters, but I do cover some of those I found useful when using the command line for the first time. There are CLIs for Windows and for Linux. Generate an HTML report of the changes that were made. ![]() Automatically generate a deployment script that when executed on the target will makes its schema the same as the source.The article provides the basis for a simple, but automated database deployment process that will Outside of his day-to-day schedule, he blogs, shares tips on forums and writes articles on his Data Messenger blog. In the past 3 years, he has expanded his focus to coding in R for assignments relating to data analytics and data science. Feodor has worked with SQL Server for over 15 years, specializing in database architecture, Microsoft SQL Server data platform, data model design, database design, integration solutions, business intelligence, reporting, as well as performance optimization and systems scalability. This is a guest post from Feodor Georgiev.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |