Retrieving Only NonNUll values from SQL Table

Posted by Nishadullas under ASP.NET on 7/22/2011 | Points: 10 | Views : 842 | Status : [Member] | Replies : 1
Thank you for the help.
But my problem is not yet solved,
I have 4 columns and want to retrieve only those columns which contains values other than NULL.
For Ex: we write query "
select Name,Contact1,Contact2,Address from details where ID=1
this query will return those mentioned columns, But now i want that if the contact1 column is having NULL value, so it should not be displyed. and this should be applied for every column and the query should retrieve only those columns of a particular row which is having value other than NULL


Posted by: Vforvijay on: 7/22/2011 [Member] Starter | Points: 25

hi..try this ..

select Name,Contact1,Contact2,Address from details where (ID=1 and contact1 is not null and contact2 is not null and address is not null)

Nishadullas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response