Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2012
    Posts
    7

    Question Unanswered: comparison Database

    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 : XYZ
    2) Server Name : DEF Database is : XYZ

    i am hving script as bellow


    use ABC


    CREATE 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 ON
    INSERT #temp
    EXEC sp_msforeachtable 'sp_spaceused ''?'''
    SELECT a.table_name,
    a.row_count,
    COUNT(*) AS col_count,
    a.data_size
    FROM #temp a
    INNER JOIN information_schema.columns b
    ON a.table_name collate database_default
    = b.table_name collate database_default
    where a.table_name not in (SELECT

    art.name as [Article]
    FROM
    dbo.syssubscriptions sub
    INNER JOIN
    sys.servers serv
    ON serv.server_id = sub.srvid
    INNER JOIN dbo.sysarticles art
    ON art.artid = sub.artid
    INNER JOIN dbo.syspublications pub
    ON pub.pubid = art.pubid )
    GROUP BY a.table_name, a.row_count, a.data_size
    order by row_count

    drop table #temp
    Last edited by niks; 08-09-12 at 03:09. Reason: add text

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Quote Originally Posted by niks View Post
    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
    Dear,
    Why? It's replicated.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •