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)
 How to create a if then statement.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-02-11 : 07:11:39
Moki writes "I have a query that has some inner join statements that run fine. the problem happens when one of the fields that I am inner joining has a null value I receive no results. What I am looking for is a If then statement where I can run a query to state if that field is null it will run a different query without that field.

Can you help?"

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-02-11 : 07:36:50
So no one wastes their time guessing what you mean, you should post the query you are working with, the rowset you are trying to generate and the ddl for the tables involved.

Jay White
{0}
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-02-11 : 08:57:32
I'll try to guess what you mean, maybe this will help:

Read about the ISNULL() function and the CASE statement at Books-On-Line.

ISNULL(Field,'Hello')

returns Field if it is not null, otherwise it returns 'Hello'. CASE is even more flexible.


- Jeff
Go to Top of Page
   

- Advertisement -