Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compare all table records in 2 Databases
Message
From
12/10/2009 06:18:35
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Microsoft SQL Server
Category:
Database management
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01428886
Message ID:
01428906
Views:
59
This message has been marked as a message which has helped to the initial question of the thread.
>>Is there a fast way or command to compare 2 database to have all the same record count in all the tables ?
>>
>>Thanks in advance.
>
>Look at using sp_MSForEachTable
>
>You can try running
>
>execute sp_MSForEachTable 'declare @Cnt int select @Cnt = count(*) from ?  print '' ?: '' + cast(@cnt as varchar(10)) '
>
>and then compare the output.
>
>Unfortunately, the tables are not in alphabetical order.

Don't you think that it is an overkill for a simple job. I would simply use a T-SQL like this:
select object_name(si.id),si.rowcnt from [sys].[sysindexes] si
	inner join [sys].[tables] st
		ON si.id = st.[object_id]
	where si.indid<2 and st.is_ms_shipped = 0
      order by object_name(si.id)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform