Tuesday, March 27, 2012

Concat_null_yields_null

How do you set the option CONCAT_NULL_YIELDS_NULL to OFF
in all databases and permenantly
?Originally posted by Karolyn
How do you set the option CONCAT_NULL_YIELDS_NULL to OFF
in all databases and permenantly

?
check sp_dboption in bol|||USE master
EXEC sp_dboption 'M158005', 'concat null yields null', 'FALSE'|||USE master
EXEC sp_dboption 'M158005', 'concat null yields null', 'FALSE'

this command doesn't change anything

Select NULL + 'TOTO'
--> NULL|||i'm replying because Karolyn asked me to in another thread

"How do you set the option CONCAT_NULL_YIELDS_NULL to OFF
in all databases and permenantly"

i have no idea

:D

whenever i run into null issues with concatenation, i always use COALESCE

e.g.

select coalesce(foo,'') & coalesce(bar,'') as foobar|||I agree with Rudy. I don't think code should rely on this setting being one value or another.|||The pb is that i'm migrating sql queries written for SYBASE
and I've got to check for concatenations in all queries
to put COALESCE() or ISNULL()
on each columns that can have a NULL value
...

I've finished migrating the queries but I still have to
check in the stored proc.

and there's lots of other programs to migrate

so setting this option should facilitate our migration

No comments:

Post a Comment