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
 General SQL Server Forums
 New to SQL Server Programming
 If...then comparison of integers

Author  Topic 

dmilam
Posting Yak Master

185 Posts

Posted - 2010-03-23 : 19:33:04
DECLARE @count1 INT, @count2 INT
SET @count1 = (SELECT COUNT(DISTINCT(ID)) FROM #temptable1)
SET @count2 = (SELECT COUNT(DISTINCT(ID)) FROM #temptable2)
IF @count1 = @count2
BEGIN
PRINT 'Yay'
END
ELSE
PRINT 'Bummer'

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=141812

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-23 : 23:52:37
whats the problem you're facing in this? also dont open multiple threads please

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

dmilam
Posting Yak Master

185 Posts

Posted - 2010-03-24 : 18:57:12
You may remove this; just wanted to show a brief snippet. Whatever appears after BEGIN isn't relevant to it. (The problem is discussed in the other thread).
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-24 : 19:00:22
I'll lock this topic then.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -