Solved

Return empty string instead of NULL in query

Posted on 2011-03-17
4
672 Views
Last Modified: 2012-05-11
Hi Experts

I am running a query to get return the file name of a picture.    It should either return the filename.jpg or be an empty string but when the record has no picture because the picture has been deleted it returns a NULL value rather than an empty string.  Even though I am replacing using NULL as criteria and return '' I still get NULL in result set.   Is there a way around this?

Thanks
Jon
case T0.[PicturName]
when NULL THEN ''
else T0.[PicturName]
END 'Picture',

Open in new window

0
Comment
Question by:JonYen
  • 3
4 Comments
 
LVL 13

Expert Comment

by:Philip Pinnell
Comment Utility
select isnull(T0.[PicturName],'') as 'Picture' from yourtable
 
0
 
LVL 13

Accepted Solution

by:
Philip Pinnell earned 500 total points
Comment Utility
select isnull(T0.[PicturName],'') as 'Picture' from T0
0
 

Author Comment

by:JonYen
Comment Utility
worked great thanks.  

0
 
LVL 13

Expert Comment

by:Philip Pinnell
Comment Utility
thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now