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
 Transact-SQL (2000)
 if.. else query help

Author  Topic 

ptran
Starting Member

4 Posts

Posted - 2004-07-09 : 10:02:37
Hi all,

How would I get this to work.
if count > 0 from the following statement:
select a.* from media2 a where a.name not in(select b.name from media1 b)
DO email 'yes'

else
Do email 'No'

thanks

Wanderer
Master Smack Fu Yak Hacker

1168 Posts

Posted - 2004-07-09 : 10:05:38
hmm:


select a.* from media2 a where a.name not in(select b.name from media1 b)
if @@rowcount > 0
do email 'yes'
else
do email 'no'


what is "do email" - it isn't T-SQL that I recognize


*##* *##* *##* *##*

Chaos, Disorder and Panic ... my work is done here!
Go to Top of Page

ptran
Starting Member

4 Posts

Posted - 2004-07-09 : 10:14:02
pseudo coding in my empty head :)

thanks
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2004-07-09 : 12:37:25
IF EXISTS(select 1 from media2 a where a.name not in(select b.name from media1 b)) BEGIN
---
END ELSE BEGIN
---
END
Go to Top of Page
   

- Advertisement -