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
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 sql server 2005: results to text - null value

Author  Topic 

anayttob
Starting Member

3 Posts

Posted - 2007-10-12 : 04:52:50
easy question:

If I use "results to text" option when executing a query in Ms SQL Server Management Studio null value is inserted as 'NULL' string in the result. Is it possible to have blank ('') string instead of 'NULL' in the result in 2005 version.

It must be possible, but I could not find it in tools/options

thank you in advance

Andras

Kristen
Test

22859 Posts

Posted - 2007-10-12 : 05:09:55
I doubt it is possible - how would you know which rows contains empty-string, and which were NULL? ...

You could make your query return empty string instead:

SELECT COALESCE(MyCol1, ''), COALESCE(MyCol2, '') ...

Kristen
Go to Top of Page

anayttob
Starting Member

3 Posts

Posted - 2007-10-12 : 05:30:39

maybe I was not accurate in explaining my problem.

look at this result to text example:


there is no value in last_grade field for 180420 and 180435 partners:


result in sql server 2005:

partner_id region last_grade
180420 13 NULL
180414 15 I
180435 1 NULL

(3 row(s) affected)



result in sql server 2000 QA:

partner_id region last_grade
180420 13
180414 15 I
180435 1

(3 row(s) affected)

I need the same result in sql 2005 as it is in 2000 QA that null value is not printed.

Thanks,

Andras
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-12 : 05:33:37
"result in sql server 2000 QA:"

I have no idea how you are managing to get that in SQL 2000 QA! Any idea of the settings you used to achieve that?

Kristen
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-12 : 05:34:27
There was a post here the other day that someone was getting NULLs in SQL 2005 queries that were displaying as empty-string in SQL 2000 (this was an Application issue, rather than Q.A. issue I think, so there may be a server-side setting of some sort.

Kristen
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-12 : 05:38:42
Found it!

Dunno if relevant, but here's a link:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=90741

Kristen
Go to Top of Page

anayttob
Starting Member

3 Posts

Posted - 2007-10-12 : 06:08:31
It is a relevant topic, but I could not find the solution in it. I check server-side settings.
Thanks for your quick answers.

Andras
Go to Top of Page
   

- Advertisement -