?
Solved

Return empty string instead of NULL in query

Posted on 2011-03-17
4
Medium Priority
?
694 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
ID: 35157396
select isnull(T0.[PicturName],'') as 'Picture' from yourtable
 
0
 
LVL 13

Accepted Solution

by:
Philip Pinnell earned 2000 total points
ID: 35157408
select isnull(T0.[PicturName],'') as 'Picture' from T0
0
 

Author Comment

by:JonYen
ID: 35157558
worked great thanks.  

0
 
LVL 13

Expert Comment

by:Philip Pinnell
ID: 35157575
thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

850 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