Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Compare the structure & code of 2 databases

By G.R.Prithiviraj Kulasingham,

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.

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

Total article views: 433 | Views in the last 30 days: 2
Related Articles

checking database online or not

checking database online or not


checking database online or not

checking database online or not


Automating SQL Server Health Check (SQL Server 2005)

This article explain how to automate SQL Database server health checks, exactly what an ideal DBA de...


Sysmail_add_principalprofile_sp – SQL Server Database Mail Stored Procedure – Part 9

Hi friends, in this blog of SQL Server Database mail stored procedure we will continue with another ...


Sysmail_help_profileaccount_sp – SQL Server Database Mail Stored Procedure – Part 8

Hi folks, in our previous blog of SQL Server Database Mail stored procedure we added database mail a...


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones