TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
neel k
NA
143
136.4k
avoid null values in sql query
Nov 25 2014 11:53 AM
hi,
This is my query. I need to display the data which is not null. I don't want to display null values. in my database there is only one record with exact city name but it display city which contain null values also.
declare
@NAME varchar(2000),
@CITY varchar(250),
@Country varchar(250)
SELECT customer_id,
(coalesce(city, '') + coalesce(', ' + state, '')) as Location ,
(coalesce(address1, '') + coalesce(', ' + address2, '') + coalesce(', ' + address3, '')) as Address
FROM customer LEFT outer JOIN usercountry on usercountry.country_ab = customer.country
left outer JOIN customerstatus on customerstatus.statusId = customer.statusid
Where
1=1
AND (city like '%' + ISNULL(@CITY,city) + '%' or city is null)
AND user_country.country like '%' + ISNULL(@Country,usercountry.country) + '%'
AND customerstatus.status = 'pending'
Thank you,
Reply
Answers (
3
)
store richtextbox data inside the iframe .
How does SQL server stores data?