Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 remove line from results,where all line is 0
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

nord
Posting Yak Master

126 Posts

Posted - 01/25/2013 :  14:01:14  Show Profile  Reply with Quote
I have 4 columns sometimes all 4 columns is 0,how i can remove this line from results
Thanks

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 01/25/2013 :  14:13:38  Show Profile  Reply with Quote
You have to use a WHERE clause like shown below:
WHERE 
	col1=0 AND col2=0 AND col3=0 AND col4=0;
Go to Top of Page

nord
Posting Yak Master

126 Posts

Posted - 01/25/2013 :  14:26:36  Show Profile  Reply with Quote
ISNULL(credit_complet_qty and credit_complet_amt and diff_arrivage_qty and diff_arrivage_amt)
I can write like that but doesnt work
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 01/25/2013 :  14:50:16  Show Profile  Reply with Quote
Can you try one of these
-- eliminate if all are nulls
WHERE
	COALESCE(col1,col2,col3,col4) IS NOT NULL;

-- eliminate if it is a combination of nulls and zeros	
WHERE
	COALESCE(NULLIF(col1,0),NULLIF(col2,0),NULLIF(col3,0),NULLIF(col4,0)) IS NOT NULL;
Go to Top of Page

nord
Posting Yak Master

126 Posts

Posted - 01/25/2013 :  15:16:22  Show Profile  Reply with Quote
Thanks a lot second one its work!!!!!!!!!!!!!!!!!!!!
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 01/25/2013 :  17:15:34  Show Profile  Reply with Quote
You are very welcome - glad to be of help.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000