PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.sqlserver.server > view seems to ignore the 'concat null yields null' option
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
view seems to ignore the 'concat null yields null' option

Réponse
 
LinkBack Outils de la discussion
Vieux 17/07/2008, 15h30   #1
Saira
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut view seems to ignore the 'concat null yields null' option

Hello all

I have a database and am concatenatiing strings in a view. the value is
coming up as null so I assumed that this was becasue 'concat null yields
null' was set to true. I changed this setting (using the below) and checked
it with the query on the database property (as well as checking the db
option) and these two checks show that everything is fine, but I still
return null. If I create a SP and set this value at runtime then the results
I get are fine. I am using SQL 2005 and my compatibility option is set to
90. Does anyone have any idea as to what is going on?

TIA
Saira

sp_dboption 'databasename', 'concat null yields null', 'false'

USE databasename

SELECT DATABASEPROPERTY('databasename', 'IsNullConcat ')


  Réponse avec citation
Vieux 17/07/2008, 16h10   #2
Tom Cooper
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: view seems to ignore the 'concat null yields null' option

My guess is that the program/driver you are using to connect to the database
is sending a
set concat_null_yields_null on
when you connect. If you are using QA, you can go to Tools|Options, and the
connections tab, and you will set a check box to specify whether or not you
want to use that option.

When you do a set concat_null_yields_null on, that overrides any value in
the database.

But it seems to me, the simplest and best solution is just to use
Coalesce(<column name>, '') in your view. Then you don't have to worry
about the setting of this option. You don't want to be depending on the
setting of these options since they are deprecated and may be removed in a
future version of SQL Server.

Tom

when you connect. If you run SQL profiler when you connect to the database
you will
"Saira" <Saira@nomail.5DFinance.com> wrote in message
news:ekTZCFB6IHA.2260@TK2MSFTNGP03.phx.gbl...
> Hello all
>
> I have a database and am concatenatiing strings in a view. the value is
> coming up as null so I assumed that this was becasue 'concat null yields
> null' was set to true. I changed this setting (using the below) and
> checked it with the query on the database property (as well as checking
> the db option) and these two checks show that everything is fine, but I
> still return null. If I create a SP and set this value at runtime then the
> results I get are fine. I am using SQL 2005 and my compatibility option is
> set to 90. Does anyone have any idea as to what is going on?
>
> TIA
> Saira
>
> sp_dboption 'databasename', 'concat null yields null', 'false'
>
> USE databasename
>
> SELECT DATABASEPROPERTY('databasename', 'IsNullConcat ')
>
>



  Réponse avec citation
Vieux 17/07/2008, 16h19   #3
Tom Cooper
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: view seems to ignore the 'concat null yields null' option

Sorry, that got somewhat garbled. It was supposed to be:

My guess is that the program/driver you are using to connect to the database
is sending a
set concat_null_yields_null on
when you connect. If you run SQL profiler when you connect to the database
I think you will see that command being sent. If you are using QA, you can
go to Tools|Options, and the connections tab, and you will set a check box
to specify whether or not you want to use that option.

When you do a set concat_null_yields_null on, that overrides any value of
the 'concat null yields null' option in the database.

But it seems to me, the simplest and best solution is just to use
Coalesce(<column name>, '') in your view. Then you don't have to worry
about the setting of this option. You don't want to be depending on the
setting of these options since they are deprecated and may be removed in a
future version of SQL Server.

Tom

"Tom Cooper" <tomcooper@comcast.no.spam.please.net> wrote in message
news:uwf0ebB6IHA.1280@TK2MSFTNGP02.phx.gbl...
> My guess is that the program/driver you are using to connect to the
> database is sending a
> set concat_null_yields_null on
> when you connect. If you are using QA, you can go to Tools|Options, and
> the connections tab, and you will set a check box to specify whether or
> not you want to use that option.
>
> When you do a set concat_null_yields_null on, that overrides any value in
> the database.
>
> But it seems to me, the simplest and best solution is just to use
> Coalesce(<column name>, '') in your view. Then you don't have to worry
> about the setting of this option. You don't want to be depending on the
> setting of these options since they are deprecated and may be removed in a
> future version of SQL Server.
>
> Tom
>
> when you connect. If you run SQL profiler when you connect to the
> database you will
> "Saira" <Saira@nomail.5DFinance.com> wrote in message
> news:ekTZCFB6IHA.2260@TK2MSFTNGP03.phx.gbl...
>> Hello all
>>
>> I have a database and am concatenatiing strings in a view. the value is
>> coming up as null so I assumed that this was becasue 'concat null yields
>> null' was set to true. I changed this setting (using the below) and
>> checked it with the query on the database property (as well as checking
>> the db option) and these two checks show that everything is fine, but I
>> still return null. If I create a SP and set this value at runtime then
>> the results I get are fine. I am using SQL 2005 and my compatibility
>> option is set to 90. Does anyone have any idea as to what is going on?
>>
>> TIA
>> Saira
>>
>> sp_dboption 'databasename', 'concat null yields null', 'false'
>>
>> USE databasename
>>
>> SELECT DATABASEPROPERTY('databasename', 'IsNullConcat ')
>>
>>

>
>



  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 06h10.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09653 seconds with 11 queries