Showing posts with label setting. Show all posts
Showing posts with label setting. Show all posts

Tuesday, March 27, 2012

Concatenatation with NULL

I am changing the setting od my database to put concatenate null yields null to off.....the following are the statements i run....

exec sp_dboption 'Solumina','concat null yields null','false'

SELECT 'abc' + NULL

I expect 'abc' to be returned after this....But not so..I get NULL

Can any one tell me this setting has to be changed at the connection level. if so, why has this been provided as a db option.

the following works....

SET CONCAT_NULL_YIELDS_NULL OFF;

SELECT 'abc' + NULL

abc

-

ODBC and SQL Query Analyzer will turn this ON by default so you need to explicitly turn the behavior OFF if you are using either of these connection mechanisms

Run this: select databaseproperty(''Solumina', 'IsNullConcat')

is the result 0? then it's set to OFF, however you have to change it from QA to make it wok in a query window

go to Tools-->options-->Connection Properties and uncheck set concat_null_yields_null

Denis the SQL Menace

http://sqlservercode.blogspot.com/

Tuesday, March 20, 2012

comprehensive details for setting up SSE?

First, soapbox questions for someone who might have more direct pull with Microsoft (or at least knowledge of how I should work with what they've given us), then a more specific question:

Scenario: You install SQL Server Express (or any other version, it doesn't matter) and the feedback with all the little green checkmarks tells you it has installed successfully. "Oh goody," say people (like me) who are not super experienced with SQL Server, "it installed successfully; now I can jump in and start using it!" But it aint so--there are so many other hoops to jump through before it really becomes operational.

After successful installation, why can't some link become visible indicating what you have to do after that? I mean, it's fine to wade through all the questions in this forum and get answers from all you nice and informed guys, AFTER the problems start coming; but I would rather not have to associate with you, to be honest, in terms of time spent that could be going into my projects.

Why isn't there a comprehensive guide right off the bat? That is, something referenced immediately that tells you such things as: how to register a database with emphasis on the fact that just creating a database won't do the trick for your application; how to set permissions and rights; that (what was I reading in the advice of one post?) you have to register both the database and the user, blah blah; all about instances, the web.config file, etc. etc. I mean, doesn't it seem logical that by virtue of a person installing the database, come on, that this is a pretty good indication that he/she in all likelihood is new at it? As it is now, all they tell you on the SSE site is that you have to have the .NET Framework installed; and the green checkmarks indicating that you've installed it correctly (sorry for mentioning that twice).

"OK, self," I say, "I have the Framework installed and SSE installed correctly, so let's get to work." Then the trouble begins. Unless Microsoft's purpose is to keep you tech guys and book writers in business, I don't understand why they don't give more up-front guidance. Any thoughts on why they work it this way? Bueller, Bueller? Anyone, anyone?

Now, to the question that's pressing me at the moment: I've installed SSE and I'm going through a tutorial ("How Do I: Create Data-Driven Web Sites?" onhttp://www.asp.net/getstarted/default.aspx?tabid=61). Yeah, the guy makes it look really easy. He creates a database then shuts down the connection. I try to do the same things and I'm informed that I don't even have a valid connection! How SQL-Server-Express fun and easy is that? It's a real AdventureWorks, if you ask me.

OK, that's my rant; and since MS didn't think in advance and implement my idea of a link to jump off from the installation menu, I have to face the reality of learning this by putting all the pieces together myself. So, my question is, before I try to go through the video and get more frustrated, WHERE DO I GO FOR THE MOST BASIC OF ALL THE STEPS I NEED TO DO, ONE BY ONE? This is like the second "beginner" video I've tried to go through but even these don't start at the very beginning with information on how to register a new database, making the user a part of aspnetWHATEVER, what permissions to dole out, etc.

Guidance is solicited and will be most appreciated. Thanks, Bryan

Hi,

I saw this: Http:www.sswug.org/see/21350 I haven't done the registration to access this site, so I can't say it will help. (Just came across it in a search). If you do check it out, let me know if it seems worthwhile.

BTW, I could find no Microsoft webcast/vids on installing SSE. Being a free product, the support is very limited. It's also a very complex and powerful program, and maybe it should be more surprising that the install is easy for anyone! I never seem to have the 'Standard' or 'Typical' system configuration that would make for an easy install. As i recall, the install of SQL Server 2005 (Standard) went easier for me than the SSE install.

I did install SSE for use with developing ASP.Net apps - works better with the defaults, and doesn't pose risks to the full version install. BRN..

Wednesday, March 7, 2012

Complex security setting on SQL 7.0

Hi,
I am running a financial database on SQL 7.0. For several reasons I cannot
upgrade to another version shortly. My problem is that I need to create
database users that have limited access to a number of tables.
Example:
tableX:
code, value, type
a, 100, x
a, 200, y
b, 300, x
b, 400, x
tableY:
code, secgroup
a, confidential
b, nonconfidential
relation between tables:
tablex.code=tableY.code
I want to setup a database user that has read-rights on tableY and limited
read-rights on tableX.
On tableX the user may only see the records for which the group in tableY
the secgroup is "nonconfidential" or for which the type in tableX is set to
"y".
Possible solution:
The only possibility I came up with so far, is to create a view on tableX
like:
create view viewX as
select tableX.code, tableX.value, tableX.type
from tableX inner join tableY on (tableX.code=tableY.code)
where tableX.type='y' or tableY.secgroup='nonconfidential'
If I now create a database user with read-rights to the view only, I think
it will work. My questions are:
1. Is this the best solution for achieving my goal?
2. What will this mean to the performance of my queries?
Any insight will be helpful.
Michel LaanFrom your description, a view appears to be the best (and possibly only)
solution. As far as performance, you will have to benchmark this yourself
because there are too many factors involved to determine this.
Rand
This posting is provided "as is" with no warranties and confers no rights.

Friday, February 17, 2012

Compatiblity level in SQL 2005

What does are the rammifications in SQL 2005 of setting the compatibility level for a database to a lower level, for example SQL 2000 (80)?

Does this affect the underlying datastructure, the stored files on the server, or the indexes?

What effect does changing the compatibility level have? Does changing it cause the server to have to do any work to the indexs or table?

TIA!

refer this link,

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/508c686d-2bd4-41ba-8602-48ebca266659.htm

performance dashboard cannot be used if the compatability is not 90.......

|||

Compatibility level allows you to keep databases in SQL Server 2005 that remain compatible with prior versions of SQL Server. This also means that you cannot use Transact-SQL extensions introduced in SQL Server 2005 with a SQL Server 2000-compatible database. AFAIK there is not much change in storage architecture of sql server 2005 from 2000. Still they are stored in Pages/extents.

Madhu

Tuesday, February 14, 2012

Compatibility level SQL Server 2000 (80) on SQL Server 2005.

Hi,
Does anyone know that after SQL Server 2000 database migrating to SQL Server
2005 server, if the compatibility level still setting on SQL Server 2000
(80), will affect database performance (such insert, update, delete, etc.)?
If I need change SQL Server 2000 (80) level to SQL Server 2005 (90) in
Database Properties for 500 GB database, how long it will take?
Regards!
-Chen"Chen" <Chen@.discussions.microsoft.com> wrote in message
news:0BF2F1FC-AA1E-4D61-B190-9F06596B3962@.microsoft.com...
> Hi,
> Does anyone know that after SQL Server 2000 database migrating to SQL
> Server
> 2005 server, if the compatibility level still setting on SQL Server 2000
> (80), will affect database performance (such insert, update, delete,
> etc.)?
>
Not really, but you can't use many new features until you switch. Since
upgrading requires testing, and changing compatibility level requires
testing, It's better if you change the compatibility level immediately and
get all your testing over with at once.
Only run in 80 compatibility mode if you identify a problem with your
database running in 90 mode that you need more time to fix.
> If I need change SQL Server 2000 (80) level to SQL Server 2005 (90) in
> Database Properties for 500 GB database, how long it will take?
>
It doesn't change the data, so it shouldn't take long.
David

Compatibility level SQL Server 2000 (80) on SQL Server 2005.

Hi,
Does anyone know that after SQL Server 2000 database migrating to SQL Server
2005 server, if the compatibility level still setting on SQL Server 2000
(80), will affect database performance (such insert, update, delete, etc.)?
If I need change SQL Server 2000 (80) level to SQL Server 2005 (90) in
Database Properties for 500 GB database, how long it will take?
Regards!
-Chen
"Chen" <Chen@.discussions.microsoft.com> wrote in message
news:0BF2F1FC-AA1E-4D61-B190-9F06596B3962@.microsoft.com...
> Hi,
> Does anyone know that after SQL Server 2000 database migrating to SQL
> Server
> 2005 server, if the compatibility level still setting on SQL Server 2000
> (80), will affect database performance (such insert, update, delete,
> etc.)?
>
Not really, but you can't use many new features until you switch. Since
upgrading requires testing, and changing compatibility level requires
testing, It's better if you change the compatibility level immediately and
get all your testing over with at once.
Only run in 80 compatibility mode if you identify a problem with your
database running in 90 mode that you need more time to fix.

> If I need change SQL Server 2000 (80) level to SQL Server 2005 (90) in
> Database Properties for 500 GB database, how long it will take?
>
It doesn't change the data, so it shouldn't take long.
David

Compatibility level SQL Server 2000 (80) on SQL Server 2005.

Hi,
Does anyone know that after SQL Server 2000 database migrating to SQL Server
2005 server, if the compatibility level still setting on SQL Server 2000
(80), will affect database performance (such insert, update, delete, etc.)?
If I need change SQL Server 2000 (80) level to SQL Server 2005 (90) in
Database Properties for 500 GB database, how long it will take?
Regards!
-Chen"Chen" <Chen@.discussions.microsoft.com> wrote in message
news:0BF2F1FC-AA1E-4D61-B190-9F06596B3962@.microsoft.com...
> Hi,
> Does anyone know that after SQL Server 2000 database migrating to SQL
> Server
> 2005 server, if the compatibility level still setting on SQL Server 2000
> (80), will affect database performance (such insert, update, delete,
> etc.)?
>
Not really, but you can't use many new features until you switch. Since
upgrading requires testing, and changing compatibility level requires
testing, It's better if you change the compatibility level immediately and
get all your testing over with at once.
Only run in 80 compatibility mode if you identify a problem with your
database running in 90 mode that you need more time to fix.

> If I need change SQL Server 2000 (80) level to SQL Server 2005 (90) in
> Database Properties for 500 GB database, how long it will take?
>
It doesn't change the data, so it shouldn't take long.
David

Compatibility Level Question

I am a little confused on the importance of the Compatability Level setting.
I have a database originally created in SQL Server 2000 that I backed up and
then restored to SQL Server 2005. The compatibility level is currently set
at 80 (SQL 2000). I would like to change this to 90 (SQL 2005) but am not
sure of the ramifications of doing this. Can someone tell me of any negative
issues I should be aware of by doing this? I would like to treat this
database as if it were created as a SQL 2005 database (IOW, I don't need any
2000 support or compatibility).
Amos.Check out the description of sp_dbcmptlevel in the SQL 2005 Books Online for
a description of the behavior differences between 80 and 90. If you see not
changes that affect your app, you are probably ok but it's always a good
idea to test.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Amos Soma" <amos_j_soma@.yahoo.com> wrote in message
news:up7T4sgEGHA.2648@.TK2MSFTNGP11.phx.gbl...
>I am a little confused on the importance of the Compatability Level
>setting. I have a database originally created in SQL Server 2000 that I
>backed up and then restored to SQL Server 2005. The compatibility level is
>currently set at 80 (SQL 2000). I would like to change this to 90 (SQL
>2005) but am not sure of the ramifications of doing this. Can someone tell
>me of any negative issues I should be aware of by doing this? I would like
>to treat this database as if it were created as a SQL 2005 database (IOW, I
>don't need any 2000 support or compatibility).
> Amos.
>

Compatibility Level Question

I am a little confused on the importance of the Compatability Level setting.
I have a database originally created in SQL Server 2000 that I backed up and
then restored to SQL Server 2005. The compatibility level is currently set
at 80 (SQL 2000). I would like to change this to 90 (SQL 2005) but am not
sure of the ramifications of doing this. Can someone tell me of any negative
issues I should be aware of by doing this? I would like to treat this
database as if it were created as a SQL 2005 database (IOW, I don't need any
2000 support or compatibility).
Amos.
Check out the description of sp_dbcmptlevel in the SQL 2005 Books Online for
a description of the behavior differences between 80 and 90. If you see not
changes that affect your app, you are probably ok but it's always a good
idea to test.
Hope this helps.
Dan Guzman
SQL Server MVP
"Amos Soma" <amos_j_soma@.yahoo.com> wrote in message
news:up7T4sgEGHA.2648@.TK2MSFTNGP11.phx.gbl...
>I am a little confused on the importance of the Compatability Level
>setting. I have a database originally created in SQL Server 2000 that I
>backed up and then restored to SQL Server 2005. The compatibility level is
>currently set at 80 (SQL 2000). I would like to change this to 90 (SQL
>2005) but am not sure of the ramifications of doing this. Can someone tell
>me of any negative issues I should be aware of by doing this? I would like
>to treat this database as if it were created as a SQL 2005 database (IOW, I
>don't need any 2000 support or compatibility).
> Amos.
>

Compatibility Level Question

I am a little confused on the importance of the Compatability Level setting.
I have a database originally created in SQL Server 2000 that I backed up and
then restored to SQL Server 2005. The compatibility level is currently set
at 80 (SQL 2000). I would like to change this to 90 (SQL 2005) but am not
sure of the ramifications of doing this. Can someone tell me of any negative
issues I should be aware of by doing this? I would like to treat this
database as if it were created as a SQL 2005 database (IOW, I don't need any
2000 support or compatibility).
Amos.Check out the description of sp_dbcmptlevel in the SQL 2005 Books Online for
a description of the behavior differences between 80 and 90. If you see not
changes that affect your app, you are probably ok but it's always a good
idea to test.
Hope this helps.
Dan Guzman
SQL Server MVP
"Amos Soma" <amos_j_soma@.yahoo.com> wrote in message
news:up7T4sgEGHA.2648@.TK2MSFTNGP11.phx.gbl...
>I am a little confused on the importance of the Compatability Level
>setting. I have a database originally created in SQL Server 2000 that I
>backed up and then restored to SQL Server 2005. The compatibility level is
>currently set at 80 (SQL 2000). I would like to change this to 90 (SQL
>2005) but am not sure of the ramifications of doing this. Can someone tell
>me of any negative issues I should be aware of by doing this? I would like
>to treat this database as if it were created as a SQL 2005 database (IOW, I
>don't need any 2000 support or compatibility).
> Amos.
>

compatibility level 80 in sql server 2005

Hi,
I have a general question about the implications of setting sql server 2005
database to compatibility level 80. It will take me some time to convert and
test the existing db schema and app to fully support sql 2005, so for now I
use this compatibility feature.
Besides not being able to use the new features of sql 2005 will setting to
compatibility level 80 effect negatively the db response time, performance,
etc...?
And if there are no problems with that temporary solution does anybody know
about any resources or articles on the web that I could provide to my
clients who are concerned about setting the compatibility level to 80?
Thank you,
VadimThere are some features in 2005 you won't be able to take advantage of but
for the most part it should not affect performance. But my question is why
are you at 80? Did you try it at 90 and have issues? Did you run the
Upgrade Advisor against your 2000 db and traces to see what issues you have
if any?
--
Andrew J. Kelly SQL MVP
"Vadim" <vadim@.dontsend.com> wrote in message
news:%23qPp0BniGHA.4716@.TK2MSFTNGP03.phx.gbl...
> Hi,
> I have a general question about the implications of setting sql server
> 2005 database to compatibility level 80. It will take me some time to
> convert and test the existing db schema and app to fully support sql 2005,
> so for now I use this compatibility feature.
> Besides not being able to use the new features of sql 2005 will setting to
> compatibility level 80 effect negatively the db response time,
> performance, etc...?
> And if there are no problems with that temporary solution does anybody
> know about any resources or articles on the web that I could provide to my
> clients who are concerned about setting the compatibility level to 80?
> Thank you,
> Vadim
>|||Andrew J. Kelly wrote:
> There are some features in 2005 you won't be able to take advantage of but
> for the most part it should not affect performance. But my question is why
> are you at 80? Did you try it at 90 and have issues? Did you run the
> Upgrade Advisor against your 2000 db and traces to see what issues you have
> if any?
> --
> Andrew J. Kelly SQL MVP
>
> "Vadim" <vadim@.dontsend.com> wrote in message
> news:%23qPp0BniGHA.4716@.TK2MSFTNGP03.phx.gbl...
> > Hi,
> > I have a general question about the implications of setting sql server
> > 2005 database to compatibility level 80. It will take me some time to
> > convert and test the existing db schema and app to fully support sql 2005,
> > so for now I use this compatibility feature.
> > Besides not being able to use the new features of sql 2005 will setting to
> > compatibility level 80 effect negatively the db response time,
> > performance, etc...?
> > And if there are no problems with that temporary solution does anybody
> > know about any resources or articles on the web that I could provide to my
> > clients who are concerned about setting the compatibility level to 80?
> >
> > Thank you,
> >
> > Vadim
> >
For backward compatibility details look into in BOL
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/instsql9/html/4760732b-aa3c-4f07-96ec-ba920476dd69.htm
Regards
Amish Shah|||Hi Andrew,
Yes, the main and I think only problem is sql syntax for linking tables for
inner and outer joins, I currently syntax compatible with Oracle and Sql
Server 7/2000, Microsoft just discontinued support for that syntax so I'll
have to chnage and test the whole app to make sure it works properly and it
takes time.
Thank you for your reply,
Vadim
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:eXcp8MqiGHA.3496@.TK2MSFTNGP02.phx.gbl...
> There are some features in 2005 you won't be able to take advantage of but
> for the most part it should not affect performance. But my question is why
> are you at 80? Did you try it at 90 and have issues? Did you run the
> Upgrade Advisor against your 2000 db and traces to see what issues you
> have if any?
> --
> Andrew J. Kelly SQL MVP
>
> "Vadim" <vadim@.dontsend.com> wrote in message
> news:%23qPp0BniGHA.4716@.TK2MSFTNGP03.phx.gbl...
>> Hi,
>> I have a general question about the implications of setting sql server
>> 2005 database to compatibility level 80. It will take me some time to
>> convert and test the existing db schema and app to fully support sql
>> 2005, so for now I use this compatibility feature.
>> Besides not being able to use the new features of sql 2005 will setting
>> to compatibility level 80 effect negatively the db response time,
>> performance, etc...?
>> And if there are no problems with that temporary solution does anybody
>> know about any resources or articles on the web that I could provide to
>> my clients who are concerned about setting the compatibility level to 80?
>> Thank you,
>> Vadim
>|||Thank you, Amish, good info but they don't mention how this affects the
performance internally, although based on the previous post it seems like
there are no performance issues.
I'll try also to run the upgrade advisor.
Vadim
"amish" <shahamishm@.gmail.com> wrote in message
news:1149742077.528427.325660@.u72g2000cwu.googlegroups.com...
> Andrew J. Kelly wrote:
>> There are some features in 2005 you won't be able to take advantage of
>> but
>> for the most part it should not affect performance. But my question is
>> why
>> are you at 80? Did you try it at 90 and have issues? Did you run the
>> Upgrade Advisor against your 2000 db and traces to see what issues you
>> have
>> if any?
>> --
>> Andrew J. Kelly SQL MVP
>>
>> "Vadim" <vadim@.dontsend.com> wrote in message
>> news:%23qPp0BniGHA.4716@.TK2MSFTNGP03.phx.gbl...
>> > Hi,
>> > I have a general question about the implications of setting sql server
>> > 2005 database to compatibility level 80. It will take me some time to
>> > convert and test the existing db schema and app to fully support sql
>> > 2005,
>> > so for now I use this compatibility feature.
>> > Besides not being able to use the new features of sql 2005 will setting
>> > to
>> > compatibility level 80 effect negatively the db response time,
>> > performance, etc...?
>> > And if there are no problems with that temporary solution does anybody
>> > know about any resources or articles on the web that I could provide to
>> > my
>> > clients who are concerned about setting the compatibility level to 80?
>> >
>> > Thank you,
>> >
>> > Vadim
>> >
> For backward compatibility details look into in BOL
> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/instsql9/html/4760732b-aa3c-4f07-96ec-ba920476dd69.htm
> Regards
> Amish Shah
>

compatibility level 80 in sql server 2005

Hi,
I have a general question about the implications of setting sql server 2005
database to compatibility level 80. It will take me some time to convert and
test the existing db schema and app to fully support sql 2005, so for now I
use this compatibility feature.
Besides not being able to use the new features of sql 2005 will setting to
compatibility level 80 effect negatively the db response time, performance,
etc...?
And if there are no problems with that temporary solution does anybody know
about any resources or articles on the web that I could provide to my
clients who are concerned about setting the compatibility level to 80?
Thank you,
VadimThere are some features in 2005 you won't be able to take advantage of but
for the most part it should not affect performance. But my question is why
are you at 80? Did you try it at 90 and have issues? Did you run the
Upgrade Advisor against your 2000 db and traces to see what issues you have
if any?
Andrew J. Kelly SQL MVP
"Vadim" <vadim@.dontsend.com> wrote in message
news:%23qPp0BniGHA.4716@.TK2MSFTNGP03.phx.gbl...
> Hi,
> I have a general question about the implications of setting sql server
> 2005 database to compatibility level 80. It will take me some time to
> convert and test the existing db schema and app to fully support sql 2005,
> so for now I use this compatibility feature.
> Besides not being able to use the new features of sql 2005 will setting to
> compatibility level 80 effect negatively the db response time,
> performance, etc...?
> And if there are no problems with that temporary solution does anybody
> know about any resources or articles on the web that I could provide to my
> clients who are concerned about setting the compatibility level to 80?
> Thank you,
> Vadim
>|||Andrew J. Kelly wrote:
[vbcol=seagreen]
> There are some features in 2005 you won't be able to take advantage of but
> for the most part it should not affect performance. But my question is why
> are you at 80? Did you try it at 90 and have issues? Did you run the
> Upgrade Advisor against your 2000 db and traces to see what issues you hav
e
> if any?
> --
> Andrew J. Kelly SQL MVP
>
> "Vadim" <vadim@.dontsend.com> wrote in message
> news:%23qPp0BniGHA.4716@.TK2MSFTNGP03.phx.gbl...
For backward compatibility details look into in BOL
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/instsql9/html/4760732b-aa3c-4f07-96ec-
ba920476dd69.htm
Regards
Amish Shah|||Hi Andrew,
Yes, the main and I think only problem is sql syntax for linking tables for
inner and outer joins, I currently syntax compatible with Oracle and Sql
Server 7/2000, Microsoft just discontinued support for that syntax so I'll
have to chnage and test the whole app to make sure it works properly and it
takes time.
Thank you for your reply,
Vadim
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:eXcp8MqiGHA.3496@.TK2MSFTNGP02.phx.gbl...
> There are some features in 2005 you won't be able to take advantage of but
> for the most part it should not affect performance. But my question is why
> are you at 80? Did you try it at 90 and have issues? Did you run the
> Upgrade Advisor against your 2000 db and traces to see what issues you
> have if any?
> --
> Andrew J. Kelly SQL MVP
>
> "Vadim" <vadim@.dontsend.com> wrote in message
> news:%23qPp0BniGHA.4716@.TK2MSFTNGP03.phx.gbl...
>|||Thank you, Amish, good info but they don't mention how this affects the
performance internally, although based on the previous post it seems like
there are no performance issues.
I'll try also to run the upgrade advisor.
Vadim
"amish" <shahamishm@.gmail.com> wrote in message
news:1149742077.528427.325660@.u72g2000cwu.googlegroups.com...
> Andrew J. Kelly wrote:
>
> For backward compatibility details look into in BOL
> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/instsql9/html/4760732b-aa3c-4f07-96e
c-ba920476dd69.htm
> Regards
> Amish Shah
>

Sunday, February 12, 2012

Comparison to NULL and '' fields

Guys, can anybody remind the settings responsible for the results of the
search by the NULL fields? I saw this database setting several months ago
but forgot this switch. The problem is the following. We're trying to run a
search in a few tables using some SQL query with a multilevel combination of
AND/OR with
WHERE SOMEFIELD LIKE '%SOMETEXT%'
If the field is NULL or '' (zero length string) then two possible results
are available depending on this database setting, true or false. The default
setting is so that if the field is NULL these records are excluded from my
result list but I need all these records to be included. So I need to find
this switch to get TRUE always when I compare to NULL strings to include the
records with NULL fields into the result list.
Thanks,
Dmitri.Do you mean
SET ANSI_NULLS
Specifies SQL-92 compliant behavior of the Equals (=) and Not Equal to (<> )
comparison operators when used with null values.
Jens SUessmeyer.
"Just D." <no@.spam.please> schrieb im Newsbeitrag
news:Ojtbe.70654$lz2.58655@.fed1read07...
> Guys, can anybody remind the settings responsible for the results of the
> search by the NULL fields? I saw this database setting several months ago
> but forgot this switch. The problem is the following. We're trying to run
> a search in a few tables using some SQL query with a multilevel
> combination of AND/OR with
> WHERE SOMEFIELD LIKE '%SOMETEXT%'
> If the field is NULL or '' (zero length string) then two possible results
> are available depending on this database setting, true or false. The
> default setting is so that if the field is NULL these records are excluded
> from my result list but I need all these records to be included. So I need
> to find this switch to get TRUE always when I compare to NULL strings to
> include the records with NULL fields into the result list.
> Thanks,
> Dmitri.
>|||I strongly recommend not to do this. Take a look at this interesting puzzle
and see the consequnces of setting ANSI_NULLS OFF.
http://groups-beta.google.com/group...aca91a7912bdc76
To accomplish what you want, use:
...
WHERE SOMEFIELD LIKE '%SOMETEXT%' or soemfield is null
AMB
"Just D." wrote:

> Guys, can anybody remind the settings responsible for the results of the
> search by the NULL fields? I saw this database setting several months ago
> but forgot this switch. The problem is the following. We're trying to run
a
> search in a few tables using some SQL query with a multilevel combination
of
> AND/OR with
> WHERE SOMEFIELD LIKE '%SOMETEXT%'
> If the field is NULL or '' (zero length string) then two possible results
> are available depending on this database setting, true or false. The defau
lt
> setting is so that if the field is NULL these records are excluded from my
> result list but I need all these records to be included. So I need to find
> this switch to get TRUE always when I compare to NULL strings to include t
he
> records with NULL fields into the result list.
> Thanks,
> Dmitri.
>
>|||Hi Jens,
Probably you're right. But if it works with LIKE ? Or only with <> = ?
Thanks,
Dmitri.
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:OIOIIenSFHA.2136@.TK2MSFTNGP14.phx.gbl...
> Do you mean
> SET ANSI_NULLS
> Specifies SQL-92 compliant behavior of the Equals (=) and Not Equal to
> (<> ) comparison operators when used with null values.
> Jens SUessmeyer.
> "Just D." <no@.spam.please> schrieb im Newsbeitrag
> news:Ojtbe.70654$lz2.58655@.fed1read07...
>|||I think it only changes the behavior of comparisons that include
at least one literal or variable that is NULL. Column-to-column
comparisons between NULLs are never true, regardless of the
setting. I think <column> LIKE NULL is never true also.
set ansi_nulls off
go
declare @.t table (
a int,
c char
)
insert into @.t values (null, null)
insert into @.t values (0, '0')
select * from @.t
where a = null
select * from @.t
where a = c
select * from @.t
where c like null
go
set ansi_nulls on
Steve Kass
Drew University
Just D. wrote:

>Hi Jens,
>Probably you're right. But if it works with LIKE ? Or only with <> = ?
>Thanks,
>Dmitri.
>"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
>message news:OIOIIenSFHA.2136@.TK2MSFTNGP14.phx.gbl...
>
>
>|||Hi Steve,
My parameters that I provide to SQL are never NULL, the string should look
like this:
SELECT * FROM blablabla WHERE Param1 LIKE '%Col1%' OR Param2 LIKE '%Col2%'
OR Param3 LIKE '%Col3%'
This is a very simplified string because actually it's a very long
combination of OR/ANDs and braces. The Param# are never NULL, but if the
value in the column is NULL then I lose this record from the result and this
is a problem. If I had some global setting it would be nice but if I don't
have this way then I need to evaluate all these cells manually and it will
be nightmare because i need to search in 20-30 fields in a few tables, the
tables are long enough and not necessarily all these value are set to
something instead of NULL.
Dmitri.
"Steve Kass" <skass@.drew.edu> wrote in message
news:uABhz7rSFHA.3312@.TK2MSFTNGP12.phx.gbl...
>I think it only changes the behavior of comparisons that include
> at least one literal or variable that is NULL. Column-to-column
> comparisons between NULLs are never true, regardless of the
> setting. I think <column> LIKE NULL is never true also.
> set ansi_nulls off
> go
> declare @.t table (
> a int,
> c char
> )
> insert into @.t values (null, null)
> insert into @.t values (0, '0')
> select * from @.t
> where a = null
> select * from @.t
> where a = c
> select * from @.t
> where c like null
> go
> set ansi_nulls on
> Steve Kass
> Drew University
> Just D. wrote:
>|||> My parameters that I provide to SQL are never NULL, the string should look
> like this:
>
> SELECT * FROM blablabla WHERE Param1 LIKE '%Col1%' OR Param2 LIKE '%Col2%'
OR
> Param3 LIKE '%Col3%'
> This is a very simplified string because actually it's a very long combina
tion
> of OR/ANDs and braces. The Param# are never NULL, but if the value in the
> column is NULL then I lose this record from the result and this is a problem.[/col
or]
As I see it, there are a couple of solutions. The first, most obvious soluti
on
is to populate those nulls with something (e.g. an empty string (ugh) ) and
set
the column to be non-nullable. Then you won't have to worry about null colum
n
values.
The other solution is to change your where clause to account for nulls like
so
(depending on the actual logic desired):
Select F1...Fn
From Table
Where Param1 Is Null
Or Param1 Like '%Col1%'
Or Param2 Is Null
Or Param2 Like '%Col2%'
Or Param3 Is Null
Or Param3 Like '%Col3%'
> If I had some global setting it would be nice but if I don't have this way
> then I need to evaluate all these cells manually and it will be nightmare
> because i need to search in 20-30 fields in a few tables, the tables are l
ong
> enough and not necessarily all these value are set to something instead of
> NULL.
I don't see that you have a whole lot of choices. It sounds like populating
those fields with something would be your easiest route. I would definitely
not
recommend playing with the ANSI_NULLS option. It will confuse the hell out o
f
any other developer that looks at your code. It is one of those unobvious
"gotchas" that developers hate.
Thomas|||Dmitri,
What you want isn't going to be found in a setting,
if you want NULL LIKE '%Col1%' to be true.
If you want rows where any column is null, along with
the once returned by the query below, try
WHERE COALESCE(Param1,'Col1') LIKE '%Col1%'
OR COALESCE(Param2,'Col2') LIKE '%Col2%'
OR COALESCE(Param3,'Col3') LIKE '%Col3%'
It seems very strange to have columns named ParamX where you
search for values called Col1, so if this is not what you want, it
will be best if you provide sample table data that includes rows
you want (matching LIKE), rows you want (because of NULLs)
and some rows you don't want, so you can explain and show us
what you want to retrieve.
SK
Just D. wrote:

>Hi Steve,
>My parameters that I provide to SQL are never NULL, the string should look
>like this:
>
>SELECT * FROM blablabla WHERE Param1 LIKE '%Col1%' OR Param2 LIKE '%Col2%'
>OR Param3 LIKE '%Col3%'
>This is a very simplified string because actually it's a very long
>combination of OR/ANDs and braces. The Param# are never NULL, but if the
>value in the column is NULL then I lose this record from the result and thi
s
>is a problem. If I had some global setting it would be nice but if I don't
>have this way then I need to evaluate all these cells manually and it will
>be nightmare because i need to search in 20-30 fields in a few tables, the
>tables are long enough and not necessarily all these value are set to
>something instead of NULL.
>Dmitri.
>"Steve Kass" <skass@.drew.edu> wrote in message
>news:uABhz7rSFHA.3312@.TK2MSFTNGP12.phx.gbl...
>
>
>