Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
malletts
Starting Member
16 Posts |
Posted - 2005-04-27 : 07:26:15
|
| hi all,can anyone advise of any utilities that can be used thatcompare 2 databases (mainly just the tables) to see if theyare identical?thanks,stephen |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2005-04-27 : 07:28:59
|
| Look at the adverts on here.-------Moo. :) |
 |
|
|
JamesH
Posting Yak Master
149 Posts |
Posted - 2005-04-27 : 07:42:29
|
| You might want to look at the information_schema views as well. Here's a sample to compare tables between two databases:CREATE Proc rsp_compare_tbls (@OldDB nvarchar(30), @NewDB nvarchar(30)) as Declare @SQL varchar(4000) truncate table s_TblChangesOnly set @SQL = 'insert s_TblChangesOnly select TABLE_CATALOG as VERSION, TABLE_NAME, ''Removed'' as STATUS from ' + @OldDB + '.information_schema.TABLES where TABLE_TYPE = ''BASE TABLE'' and TABLE_NAME not in (select TABLE_NAME from '+ @NewDB + '.information_schema.TABLES where TABLE_TYPE = ''BASE TABLE'') Union ALL select TABLE_CATALOG as VERSION, TABLE_NAME, ''New'' as STATUS from ' + @NewDB + '.information_schema.TABLES where TABLE_TYPE = ''BASE TABLE'' and TABLE_NAME not in (select TABLE_NAME from ' + @OldDB + '.information_schema.TABLES where TABLE_TYPE = ''BASE TABLE'') order by TABLE_CATALOG, TABLE_NAME' Exec (@SQL) select * from s_TblChangesOnly You also have the ability to query columns, views, etc. HTH,JamesH. |
 |
|
|
ajthepoolman
Constraint Violating Yak Guru
384 Posts |
Posted - 2005-04-27 : 12:31:19
|
| http://www.database-comparison.com |
 |
|
|
bakerjon
Posting Yak Master
145 Posts |
|
|
|
|
|
|
|