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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Comparing table counts from 2 tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-22 : 08:56:57
Alan writes "I need a method for combining several procs into one. Each proc compares the record counts on one table from each database (a similar table exists in each database) then executes xp_sendmail if the counts do not match. I would like to have single proc compare all of the table counts then execute one xp_sendmail of the tables that do not match. Any help is greatly appreciated. A copy of my proc is below.

declare @CMCount varchar(25), @AuditCount varchar(25)

select @CMCount = count(*) from usa..company_master
select @AuditCount = count(*) from processing..CompanyAudit

IF @CMCount != @AuditCount
BEGIN
EXEC master..xp_sendmail @recipients = 'recepient1; recepient2',
@subject = 'Error in Company_Master load',
@message = 'Company counts do not match'
END"

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-04-22 : 14:56:31
do you have a list of procedure pairs ( which procedure in database a should be matched with which procedure in database b? )

setBasedIsTheTruepath
<O>
Go to Top of Page
   

- Advertisement -