SQL Server Central is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

Compare the structure & code of 2 databases

By G.R.Preethiviraj Kulasingham, 2002/03/22

Total article views: 150 | Views in the last 30 days: 8

We often make changes in the test databases. But failure in making even the smallest change in the production database may lead to unwanted situations.

This utility compares 2 databases.
Parameters to be passed  
@DB1  Database 1 (SysName) 
@DB2  Databse 2 (SysName) 
@ShowDifferentOnly see later (Bit) 
    
Parameters 1, 2 may include server name as  well.
But the server should be either local or linked server.
This Procedure is devided into 2 parts 
Part I Checks the tables and Views (Column Definition, size, default) etc. 
Part II Checks the Code of Views, Stored Procedures and Triggers 
If @ShowDifferentOnly is set to 1 it will show only the lines that are different 
Otherwise all lines of both objects are shown. 
Default for @ShowDifferentOnly is 1 

Tested in SQLServer 2000 Service Pack 1. 

Known Issues:
If Server name or the database name is with space, it should be included with single Quote and not with braces ([]). This procedure is not checking for the braces in the name.

Note:
This procedure does not check the data. Only the structure is checked.

By G.R.Preethiviraj Kulasingham, 2002/03/22

Total article views: 150 | Views in the last 30 days: 8
Your response
 
 
Related tags
 
Already registered?  

Free registration required

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Register

E-mail address:
Password:
Password (confirm):

  

Subscriptions

We ask you to register on the site and subscribe to our newsletters. Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

We ask that you give the newsletter a try for a week. Over 200,000 SQL Server Professionals a day find it entertaining and useful. If not, you are welcome to unsubscribe at anytime.

Steve Jones
Editor, SQLServerCentral.com