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)
 Some Help In Query

Author  Topic 

samamun001
Starting Member

17 Posts

Posted - 2005-10-30 : 01:02:51
Hi there,
I hava arround 15 data field. I want to make an inner join based on the value of the data field, that is i have to check whether all of them are empty or not. If one of them has value then make the inner join, that is to make inner join at least one data field needs to have value.

Now my problem is to check whether the data fields are empty or not do i use only if statement? or any other way.

For Example:
data1,...............data15

if data1 <> '' or data2 <> '' ...............or data15 <> ''
make inner join


is this is the only way
Plz Help



samamun

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-10-30 : 19:45:56
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Read that and post so we can help you quicker. It sounds like you're just wanting a LEFT OUTER JOIN with the data fields specified in the JOIN. The fact that you're having to do this is somewhat scary though. Bad database design?? The execution plans on this kind of thing are going to be horrible. Also, are you really storing blank spaces in your databases instead of NULL? If so, why?

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -