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 |
niks
Starting Member
9 Posts |
Posted - 2012-08-09 : 02:10:42
|
Dear,I need script that i can configure as a daily alert, I need to compare database i replicated. I want to compare Raw count, i have one query as bellow but my problem it how to compare it from two differ database server. 1) Server Name : ABC Database is : XYZ2) Server Name : DEF Database is : XYZi am hving script as bellow use ABCCREATE TABLE #temp (table_name sysname ,row_count INT,reserved_size VARCHAR(50),data_size VARCHAR(50),index_size VARCHAR(50),unused_size VARCHAR(50))SET NOCOUNT ONINSERT #tempEXEC sp_msforeachtable 'sp_spaceused ''?'''SELECT a.table_name,a.row_count,COUNT(*) AS col_count,a.data_sizeFROM #temp aINNER JOIN information_schema.columns bON a.table_name collate database_default= b.table_name collate database_default where a.table_name not in (SELECTart.name as [Article] FROM dbo.syssubscriptions subINNER JOIN sys.servers servON serv.server_id = sub.srvidINNER JOIN dbo.sysarticles artON art.artid = sub.artidINNER JOIN dbo.syspublications pubON pub.pubid = art.pubid ) GROUP BY a.table_name, a.row_count, a.data_size order by row_countdrop table #tempRegdsNiks |
|
|
|
|