dbTalk Databases Forums  

How to check setting of CONCAT_NULL_YIELDS_NULL

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss How to check setting of CONCAT_NULL_YIELDS_NULL in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
metaperl
 
Posts: n/a

Default How to check setting of CONCAT_NULL_YIELDS_NULL - 02-11-2008 , 06:55 PM






I would like to check the setting of this variable in our MS-SQL 2000
database. Also, is there info on what the default value of this
variable is?


Reply With Quote
  #2  
Old   
metaperl
 
Posts: n/a

Default Re: How to check setting of CONCAT_NULL_YIELDS_NULL - 02-11-2008 , 07:45 PM






On Feb 11, 7:55 pm, metaperl <metap... (AT) gmail (DOT) com> wrote:
Quote:
Also, is there info on what the default value of this
variable is?
Found it - to check the current value , you can use SESSIONPROPERTY -
http://msdn2.microsoft.com/en-us/library/ms175001.aspx




Reply With Quote
  #3  
Old   
Plamen Ratchev
 
Posts: n/a

Default Re: How to check setting of CONCAT_NULL_YIELDS_NULL - 02-11-2008 , 08:44 PM



You can also check the status of this option in your database using
DATABASEPROPERTYEX:
SELECT DATABASEPROPERTYEX('MyDatabase', 'IsNullConcat')

But since the connection level settings can override the default database
setting, using SESSIONPROPERTY('CONCAT_NULL_YIELDS_NULL') will give you the
value for the current session.

HTH,

Plamen Ratchev
http://www.SQLStudio.com


Reply With Quote
  #4  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: How to check setting of CONCAT_NULL_YIELDS_NULL - 02-12-2008 , 02:12 AM



Plamen Ratchev (Plamen (AT) SQLStudio (DOT) com) writes:
Quote:
You can also check the status of this option in your database using
DATABASEPROPERTYEX:
SELECT DATABASEPROPERTYEX('MyDatabase', 'IsNullConcat')
But that setting applies only to clients that uses a legacy API. That is,
by setting this setting ON, you can force a client that connects with
DB-Library to have CONACT_NULL_YIELDS_NULL on. Another way to do this is
the server-level configuration option 'user options'.

If you connect with a modern API, you will have CONCAT_NULL_YIELDS_NULL on
even if the database setting is off.

Quote:
But since the connection level settings can override the default
database setting, using SESSIONPROPERTY('CONCAT_NULL_YIELDS_NULL') will
give you the value for the current session.
Yes, that is the one to check.

The same applies to other ANSI settings. Except that for ANSI_NULL and
QUOTED_IDENTIFIER, the setting is saved with the stored procedure.

Very, very confusing.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
  #5  
Old   
Plamen Ratchev
 
Posts: n/a

Default Re: How to check setting of CONCAT_NULL_YIELDS_NULL - 02-12-2008 , 07:10 AM



"Erland Sommarskog" <esquel (AT) sommarskog (DOT) se> wrote

Quote:
Plamen Ratchev (Plamen (AT) SQLStudio (DOT) com) writes:
You can also check the status of this option in your database using
DATABASEPROPERTYEX:
SELECT DATABASEPROPERTYEX('MyDatabase', 'IsNullConcat')

But that setting applies only to clients that uses a legacy API. That is,
by setting this setting ON, you can force a client that connects with
DB-Library to have CONACT_NULL_YIELDS_NULL on. Another way to do this is
the server-level configuration option 'user options'.

If you connect with a modern API, you will have CONCAT_NULL_YIELDS_NULL on
even if the database setting is off.


Correct. I just recently had this case at a client site where a third-party
app to bridge between DB2 and SQL Server was setting it to OFF, very
confusing until I found out.


Quote:
But since the connection level settings can override the default
database setting, using SESSIONPROPERTY('CONCAT_NULL_YIELDS_NULL') will
give you the value for the current session.

Yes, that is the one to check.

The same applies to other ANSI settings. Except that for ANSI_NULL and
QUOTED_IDENTIFIER, the setting is saved with the stored procedure.

Very, very confusing.


Couldn't agree more. I haven't had a chance to look up those in SQL Server
2008. Any chance it will get better?


Quote:
--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx

Plamen Ratchev
http://www.SQLStudio.com



Reply With Quote
  #6  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: How to check setting of CONCAT_NULL_YIELDS_NULL - 02-12-2008 , 04:42 PM



Plamen Ratchev (Plamen (AT) SQLStudio (DOT) com) writes:
Quote:
The same applies to other ANSI settings. Except that for ANSI_NULL and
QUOTED_IDENTIFIER, the setting is saved with the stored procedure.

Very, very confusing.

Couldn't agree more. I haven't had a chance to look up those in SQL Server
2008. Any chance it will get better?
Not any that I have noticed.

The version after SQL 2008 will drop support for DB-Library, but I don't
think that will have any further repurcussions, although the database
options will become virtually meaningless (as if they are not already).

Maybe in SQL 2035 they will drop all legacy settings. But Microsoft
has some cleaning up in their own backyard to do. When you connect with
SQLCMD, QUOTED_IDENTIFIER is off by default.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
  #7  
Old   
Plamen Ratchev
 
Posts: n/a

Default Re: How to check setting of CONCAT_NULL_YIELDS_NULL - 02-12-2008 , 05:22 PM



I can understand keeping some legacy settings. But perhaps enforcing that
they are available in old compatibility mode only. Otherwise just too many
shops keep pushing it the old way until that moment the inevitable
happens...

Thanks Erland!

Plamen Ratchev
http://www.SQLStudio.com


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.