473,387 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Order of predicates in where clause important - invalid use of null

Hi spent a few hours on this one wrote a query that joined on results
of 2 other queries.

Qry3 using Qry1 and Qry2
When I used Qry1.FasText <cstr(Qry2.FasInteger) in the where clause
- got invalid use of null.

Fair enough Field1 and Field2 can contain nulls

I altered the 2 queries to exclude nulls from FasText and FasInteger-
same error.
Excluded nulls in Qry3 - same error.

The solution was to move "FasInteger is not null" to be the first part
of the where clause. This should NOT matter...

further rant..
This reminds of my first experience of Access where left outer join
was doing the same as an inner join - later found out was using old
version of jet. Still it should have produced an error not done the
next best thing...

Would you fly in a plane that used Access as its DB - I certainly
wouldn't

Jul 3 '07 #1
9 2804
Yitzak wrote:
Otherwise its a bug...
*Or* you don't understand what you're working with. I don't really care
about Jet, because as I mentioned all of my professional work is against
Oracle with Jet being used only for tinkering. Jet certainly has its
limitations but like Oracle or any other dbms, mixing views can be
perilous if you don't know for sure what you're doing. 8) But by the
sounds of your post, it's appears inconceiveable that anything might be
wrong with yourwork on anything! 8)
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
Jul 5 '07 #2
Yitzak <te*********@yahoo.co.ukwrote:
Hi spent a few hours on this one wrote a query that joined on results
of 2 other queries.

Qry3 using Qry1 and Qry2
When I used Qry1.FasText <cstr(Qry2.FasInteger) in the where clause
- got invalid use of null.

Fair enough Field1 and Field2 can contain nulls

I altered the 2 queries to exclude nulls from FasText and FasInteger-
same error.
Excluded nulls in Qry3 - same error.

The solution was to move "FasInteger is not null" to be the first part
of the where clause. This should NOT matter...
This sounds very interesting. Please could you provide the complete
and explicit SQL statements for your example, including table
definitions and example values so that we can reproduce your results?

Greetings
Matthias Kläy
--
www.kcc.ch
Jul 6 '07 #3
On 6 Jul, 02:52, Matthias Klaey <m...@hotmail.comwrote:
Yitzak <terrysha...@yahoo.co.ukwrote:
Hi spent a few hours on this one wrote a query that joined on results
of 2 other queries.
Qry3 using Qry1 and Qry2
When I used Qry1.FasText <cstr(Qry2.FasInteger) in the where clause
- got invalid use of null.
Fair enough Field1 and Field2 can contain nulls
I altered the 2 queries to exclude nulls from FasText and FasInteger-
same error.
Excluded nulls in Qry3 - same error.
The solution was to move "FasInteger is not null" to be the first part
of the where clause. This should NOT matter...

This sounds very interesting. Please could you provide the complete
and explicit SQL statements for your example, including table
definitions and example values so that we can reproduce your results?

Greetings
Matthias Kläy
--www.kcc.ch
Matthias - its not feasible.

The problem arose from joining 2 queries, both queries were based on
Huge tables not just in terms of number of rows but also number of
columns (DB schema is not relational :-).

The 2 queries which were joined to form new query were joined using
left outer join The field that was used in the where clause which had
to be moved so as new query did not error was *NOT* the field used in
the join.

All base tables are linked via ODBC to a SQL Server DB. Is this the
issue? that is ODBC

The query has other "weirdness" e.g. it compiled/saved even though it
says things like
numberfield Like "1" numberfield is a numeric field. I thought this
would error with type mismatch??

Jul 8 '07 #4
On Jul 7, 9:07 pm, Yitzak <terrysha...@yahoo.co.ukwrote:
On 6 Jul, 02:52, Matthias Klaey <m...@hotmail.comwrote:
Yitzak <terrysha...@yahoo.co.ukwrote:
Hi spent a few hours on this one wrote a query that joined on results
of 2 other queries.
Qry3 using Qry1 and Qry2
When I used Qry1.FasText <cstr(Qry2.FasInteger) in the where clause
- got invalid use of null.
Fair enough Field1 and Field2 can contain nulls
I altered the 2 queries to exclude nulls from FasText and FasInteger-
same error.
Excluded nulls in Qry3 - same error.
The solution was to move "FasInteger is not null" to be the first part
of the where clause. This should NOT matter...
This sounds very interesting. Please could you provide the complete
and explicit SQL statements for your example, including table
definitions and example values so that we can reproduce your results?
Greetings
Matthias Kläy
--www.kcc.ch

Matthias - its not feasible.

The problem arose from joining 2 queries, both queries were based on
Huge tables not just in terms of number of rows but also number of
columns (DB schema is not relational :-).

The 2 queries which were joined to form new query were joined using
left outer join The field that was used in the where clause which had
to be moved so as new query did not error was *NOT* the field used in
the join.

All base tables are linked via ODBC to a SQL Server DB. Is this the
issue? that is ODBC

The query has other "weirdness" e.g. it compiled/saved even though it
says things like
numberfield Like "1" numberfield is a numeric field. I thought this
would error with type mismatch??
I used to have a strange query. When I ran it in the morning three
pink flamingoes engaged in group sex on my front lawn. When I ran it
in the evening, George Bush seemed to make sense. I'm sorry I can't
provide you with more details as the whole thing was very weird. But
you can take my word for it: Access is fatally flawed.

Jul 8 '07 #5
On Sun, 08 Jul 2007 03:49:22 -0000, lyle <ly************@gmail.com>
wrote:
>
I used to have a strange query. When I ran it in the morning three
pink flamingoes engaged in group sex on my front lawn. When I ran it
in the evening, George Bush seemed to make sense. I'm sorry I can't
provide you with more details as the whole thing was very weird. But
you can take my word for it: Access is fatally flawed.
Lyle, I've enjoyed your wit and effective use of satire for some time
now. The last time that I voiced approval in this newsgroup, however,
I was promptly killfiled by Stephen LeBans. Since I don't wish to
incur the displeasure of Mr LeBans or anyone else for that matter,
I'll refrain from further comment.
Jul 8 '07 #6
On 8 Jul, 18:11, Matthias Klaey <m...@hotmail.comwrote:
Now the question remains: *Why* do you get this "unexpected" behavior,
and can it be classified as a "bug" of Access? I will leave the answer
to other people, but I would first look at the query execution plan.

HTH
Matthias Kläy
--www.kcc.ch
Forgot - Access can show you the query execution plan. How? This would
be invaluable to me - so that I can tell if certain queries are using
indexes..


Jul 8 '07 #7
Yitzak <te*********@yahoo.co.ukwrote:
On 8 Jul, 18:11, Matthias Klaey <m...@hotmail.comwrote:
Now the question remains: *Why* do you get this "unexpected" behavior,
and can it be classified as a "bug" of Access? I will leave the answer
to other people, but I would first look at the query execution plan.

HTH
Matthias Kläy
--www.kcc.ch

Forgot - Access can show you the query execution plan. How? This would
be invaluable to me - so that I can tell if certain queries are using
indexes..
See, e.g.,

http://articles.techrepublic.com.com...2-5064388.html

Greetings
Matthias Kläy
--
www.kcc.ch
Jul 8 '07 #8
Yitzak <te*********@yahoo.co.ukwrote:
THANKS for the Nz - I was looking for the equivalent of isnull(fld,'')
function.

I cannot find the help, just need reference really of ACCESS's dialect
of SQL i.e. a list of all the reserved words in Access's version of
SQL. does such a thing exist in the help files? E.G. a search for Nz
in my help file produces nothing.
To find the help topics you are interested in, open any code module,
then click "Help / Microsoft Visual Basic Help" on the menu. This
should get you to the Visual Basic Help/Table of Contents.

You will find Nz under the "Microsoft Access Visual Basic
Reference/Functions" which is an extension of "Microsoft Visual Basic
Reference" for the Access object model.

Using functions like Nz or CStr in query expressions is not exactly
part of SQL, it is available since Jet uses the Visual Basic
Expression Service, thus this is a (very powerful) extension of SQL.

SQL you will find at the same place in "Microsoft Jet SQL Reference".
Greetings
Matthias Kläy
--
www.kcc.ch
Jul 8 '07 #9
On 8 Jul, 20:59, Matthias Klaey <m...@hotmail.comwrote:
Yitzak <terrysha...@yahoo.co.ukwrote:
On 8 Jul, 18:11, Matthias Klaey <m...@hotmail.comwrote:
Now the question remains: *Why* do you get this "unexpected" behavior,
and can it be classified as a "bug" of Access? I will leave the answer
to other people, but I would first look at the query execution plan.
HTH
Matthias Kläy
--www.kcc.ch
Forgot - Access can show you the query execution plan. How? This would
be invaluable to me - so that I can tell if certain queries are using
indexes..

See, e.g.,

http://articles.techrepublic.com.com...2-5064388.html

Greetings
Matthias Kläy
--www.kcc.ch
Fantastic - I've only ever used query plans to see if it a query is
using an index or if table scanning to decide what index to put on;
Exactly what I was looking for.

VBA help - obvious when I think about it (maybe should try a bit more
of it) - I'm a newbie to Access.

Checked Nz out - it is a function of Access.Application class - know
where to look now..

Thanks again Matthias , and also Tina who answered my previous post -
I've learnt alot about Access from your replies.
Jul 8 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: sqlgoogle | last post by:
Hi I'm trying to update a db based on the select statement which has ORDER BY in it. And due to that I'm getting error which states that Server: Msg 1033, Level 15, State 1, Line 13 The ORDER...
14
by: joshsackett | last post by:
I have a WHERE clause that could be an "=" or a "LIKE" depending upon if the passed variable is populated or not. I would like to know the best way to write the WHERE clause to make it dynamically...
1
by: mailar | last post by:
Hi, Can I use ORDER BY clause in my sql UDF that returns a table and has the folloing body. (trial_udf.sql) drop function aa@ create function aa() returns TABLE(empno varchar(20)) language...
1
by: florian.boldt | last post by:
Hi Folks, one of our developers uses a statement with a where clause which usually does not match to any rows. In case of one or more rows found she wrote a an expression in the select clause...
4
by: dtwalter | last post by:
Is it possible to ORDER BY a SubSelect? I don't see why it wouldn't be, but I'm having some trouble. Hopefully it's just a simple error in syntax and somebody can tell me. Here's what I'm trying...
104
by: Beowulf | last post by:
I have the view below and if I use vwRouteReference as the rowsource for a combo box in an MS Access form or run "SELECT * FROM vwRouteReference" in SQL Query Analyzer, the rows don't come through...
7
by: mandible | last post by:
Hello I'm trying to have some control on how my data is ordered depending on an input parameter my question is in a stored procedure how can I do something like this at the end of my...
6
by: InnoCreate | last post by:
Hi everyone. I've recently written a classic asp website which uses an MS Access datasource. I know this is less than an ideal data source as it has limited functionality. I have a search form on...
12
by: =?ISO-8859-1?Q?Ren=E9?= | last post by:
Hi, is there a rule of thumb what is better/faster/more performant in SQL Server 2005? a) SELECT * FROM A INNER JOIN B ON B.ID = A.ID AND B.Cond1 = 1 AND B.Cond2 = 2 b) SELECT * FROM A INNER...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.