Solved

How to compare Database tables / schema in SQL Server 2005 ?

Posted on 2011-02-17
4
573 Views
Last Modified: 2012-06-27
Hi All,

Is it possible to create or do it from SSMS to compare two different schema ?

I need to compare database table in my current production DB to see which one is different in order to generate delta (upgrade script)

Thanks.
0
Comment
Question by:jjoz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 41

Expert Comment

by:Sharath
ID: 34922413
What exactly you want to compare? Do you want to check the no. of tables in one schema to another schema or between two databases?
0
 
LVL 1

Author Comment

by:jjoz
ID: 34922434
'Do you want to check the no. of tables in one schema to another schema or between two databases?"
yes exactly or even better the time last accessed or used by someone.

because I'm not sure which one is safe to delete at the moment.
0
 
LVL 41

Accepted Solution

by:
Sharath earned 500 total points
ID: 34922511
-- This query gives the no. of tables in each Schema. You need to run this both on Production and your dev server for same database to check the no. of tables
select TABLE_SCHEMA,COUNT(*) TableCount from INFORMATION_SCHEMA.TABLES group by TABLE_SCHEMA
-- You can get the last modified date of a table with the below query
select * from sys.tables order by modify_date desc

Open in new window

0
 
LVL 1

Author Closing Comment

by:jjoz
ID: 34931994
many thanks man !
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question