469,289 Members | 2,169 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,289 developers. It's quick & easy.

TSQL - IF EXISTS SELECT From Mulitple Tables

Dear Gurus,

How do I determine if data exists from multiple tables in SQL Server
2000?

For example,

IF EXISTS
(
( SELECT ColA FROM TableA WHERE ... ) AND
( SELECT ColB FROM TableB WHERE ... )
)
BEGIN
-- Need to do something here
END
Thanks in advance...

Jonathan

Oct 21 '08 #1
1 9102
"Jonathan Woods" <ye******@gmail.comwrote in message
news:f5**********************************@25g2000p rz.googlegroups.com...
How do I determine if data exists from multiple tables in SQL Server
2000?

For example,

IF EXISTS
(
( SELECT ColA FROM TableA WHERE ... ) AND
( SELECT ColB FROM TableB WHERE ... )
)
BEGIN
-- Need to do something here
END
Rewrite it as
IF Exists (select...from TableA...) AND Exists (select...from
TableB...)

Another option would be
IF Exists (select... from TableA INNER JOIN TableB ON...)

You may get some better answers if you ask this question in a Sql Server
newsgroup instead of the C# one.

Oct 21 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Steve | last post: by
7 posts views Thread by jennifer1970 | last post: by
reply views Thread by BenCoo | last post: by
4 posts views Thread by eeb4u | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.