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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL output to grid

Author  Topic 

funk.phenomena
Posting Yak Master

121 Posts

Posted - 2011-05-19 : 23:06:31
Hi All -

I have a query that outputs the results to the grid.
I will either copy and paste the results into Excel, or I will save the result set as a CSV file.

How can I have all the NULL values display as blank values, rather than with the 'NULL' text?

Thanks!!!!

joshherman
Starting Member

13 Posts

Posted - 2011-05-19 : 23:17:44
use condition in field value.
for example :

select case when column1 is null then '' else column1 end as colresult from table


and when you run this, you will not get NULL value

programming
Go to Top of Page

funk.phenomena
Posting Yak Master

121 Posts

Posted - 2011-05-19 : 23:20:12
Thanks for your response, however I have about 25 SELECT statements combined with cases/coalesce statements.
Any alternatives?
Go to Top of Page

MichaelJSQL
Constraint Violating Yak Guru

252 Posts

Posted - 2011-05-21 : 14:25:20
This should work

Select isnull(column1,'') as column1 from sometable
Go to Top of Page

jfarrugia
Yak Posting Veteran

55 Posts

Posted - 2011-05-23 : 08:01:35
isnull(column, '') for text isnull(column, 0) for numeric

Where software development knowledge meets the reader
Go to Top of Page
   

- Advertisement -