• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 587
  • Last Modified:

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

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
jjoz
Asked:
jjoz
  • 2
  • 2
1 Solution
 
SharathData EngineerCommented:
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
 
jjozAuthor Commented:
'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
 
SharathData EngineerCommented:
-- 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
 
jjozAuthor Commented:
many thanks man !
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now