SQL Server 2005 database comparison

user3796520

I am working on a project of Data Centralization. I have to transfer data from two databases into a third newly created master database.The existing databases hold the same type of data, the tables are the same etc. But before that, I need to check whether the master tables from the existing two databases are the same i.e. the column names, number etc are same of the two same tables in both the databases. For e.g. Both the databases have a table called SROMaster. I need to check if SROMaster from db1 will hold the same columns as SROMaster from db2. Can someone help me? Thanks!

marc_s

Not sure what platform/language you're using - but in any case, to test if a given table exists, you can use this T-SQL to do the job:

SELECT t.*
FROM sys.tables t
WHERE t.Name = 'SROMaster'

That will return a row with all the info about the table - if it exists - otherwise you can nothing back.

Once you have the table, you can check what columns the table has by using:

SELECT c.*
FROM sys.columns c
INNER JOIN sys.tables t ON c.object_id = t.object_id
WHERE t.Name = 'SROMaster'
ORDER BY c.column_id

You'll get back a data set of rows with information about the columns - compare those two lists you're getting to see if you have the same columns in both table's SROMaster table.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

SQL Server 2005 database comparison

From Dev

Sql server 2005 how to create a database from a dump of a database

From Dev

A SQL Server 2005 Express query that will add a table per database

From Dev

Report Services (SSRS) 2005 connect database in Microsoft SQL Server 2014

From Dev

Encryption SQL Server 2005

From Dev

Debugging SQL Server 2005 database with SQL Server 2008 R2 Debugger

From Dev

Dynamic PIVOT in SQL Server 2005

From Dev

Cube Creation in SQL Server 2005

From Dev

order by case in sql 2005 server

From Dev

order by case in sql 2005 server

From Dev

Retrieving hierarchy in SQL Server 2005

From Dev

Update Target Button is disabled in Sql Server Database Schema Comparison

From Dev

sql server store comparison operators in database and use in case statement

From Dev

Python: df.to_sql with OperationalError 1046, 'No database selected and OperationalError 2005, "Unknown MySQL server hos

From Dev

SQL convert DateTime to Date (SQL server 2005)

From Dev

Microsoft SQL Server 2005 - DVWA - SQL Injection

From Dev

Performing Recursive SQL Query (SQL Server 2005)

From Dev

sql server string comparison

From Dev

Key Value Pair XML (SQL Server 2005)

From Dev

RollBack insert to multiple tables in SQL Server 2005

From Dev

SQL Server 2005 using order by case

From Dev

Cross Join Values in SQL Server 2005

From Dev

Working SQL Server 2005 Query Optimization

From Dev

SQL Server 2005 : If statement with return value

From Dev

Error Script Connection SQL SERVER 2005

From Dev

Select DATEADD minutes with query SQL Server 2005

From Dev

SQL Server 2005 MAX, SUM AND GROUP BY

From Dev

Error in using IF EXISTS in SQL Server 2005

From Dev

Update based on previous value SQL SERVER 2005

Related Related

  1. 1

    SQL Server 2005 database comparison

  2. 2

    Sql server 2005 how to create a database from a dump of a database

  3. 3

    A SQL Server 2005 Express query that will add a table per database

  4. 4

    Report Services (SSRS) 2005 connect database in Microsoft SQL Server 2014

  5. 5

    Encryption SQL Server 2005

  6. 6

    Debugging SQL Server 2005 database with SQL Server 2008 R2 Debugger

  7. 7

    Dynamic PIVOT in SQL Server 2005

  8. 8

    Cube Creation in SQL Server 2005

  9. 9

    order by case in sql 2005 server

  10. 10

    order by case in sql 2005 server

  11. 11

    Retrieving hierarchy in SQL Server 2005

  12. 12

    Update Target Button is disabled in Sql Server Database Schema Comparison

  13. 13

    sql server store comparison operators in database and use in case statement

  14. 14

    Python: df.to_sql with OperationalError 1046, 'No database selected and OperationalError 2005, "Unknown MySQL server hos

  15. 15

    SQL convert DateTime to Date (SQL server 2005)

  16. 16

    Microsoft SQL Server 2005 - DVWA - SQL Injection

  17. 17

    Performing Recursive SQL Query (SQL Server 2005)

  18. 18

    sql server string comparison

  19. 19

    Key Value Pair XML (SQL Server 2005)

  20. 20

    RollBack insert to multiple tables in SQL Server 2005

  21. 21

    SQL Server 2005 using order by case

  22. 22

    Cross Join Values in SQL Server 2005

  23. 23

    Working SQL Server 2005 Query Optimization

  24. 24

    SQL Server 2005 : If statement with return value

  25. 25

    Error Script Connection SQL SERVER 2005

  26. 26

    Select DATEADD minutes with query SQL Server 2005

  27. 27

    SQL Server 2005 MAX, SUM AND GROUP BY

  28. 28

    Error in using IF EXISTS in SQL Server 2005

  29. 29

    Update based on previous value SQL SERVER 2005

HotTag

Archive