Solved

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

Posted on 2011-02-17
4
569 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…

739 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