473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 9197
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steve | last post by:
Hi; I'm brand spanking new to sqlserver ( nice so far ). I need to make a simple data change across a list of tables. Basically replace an old date with a new date. However, the people I am...
18
by: mountain man | last post by:
Greetings to all database professionals and laymen, Let us make a bold assumption that we have developed a software tool for the SQL Server environment which simply acts as an interface between...
11
by: randi_clausen | last post by:
Using SQL against a DB2 table the 'with' key word is used to dynamically create a temporary table with an SQL statement that is retained for the duration of that SQL statement. What is the...
0
by: jamiemcc | last post by:
Hi, I would like to have 1 stored procedure call another stored procedure (which contains multiple select statements) and then be able to access the 3 result sets. Example Create Procedure ....
7
by: jennifer1970 | last post by:
I need to insert records into the table parSalesDetailModifier from OLDparSalesDetailModifier where (1) those records DO NOT exit in parSalesDetailModifier and (2) those records have a parent...
3
by: David Lozzi | last post by:
Howdy, ISSUE 1: See issue 2 below. I have a distance calculator on my site which works great. However, the users need to sort by distance, which make sense. I'm not sure how to do it other than...
0
by: BenCoo | last post by:
Hello everyone, I'm programming in VB.NET 2005 and I habe not much experience with database programming. I'm in search for some sql for the following : I have 3 database tables:...
0
by: dharper | last post by:
Hi! I'm new to sql 2005 and need to run an automated report that is a fairly simple fixed width ragged right report. Problem is I need a header in the report that has static text, plus the rowcount...
4
by: eeb4u | last post by:
I am connecting to MS SQL 2000 from Red Hat EL4 using freetds and currently running queries to get counts on tables etc. When running SELECT queries I notice that the data returns and I have to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.