473,386 Members | 1,766 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,386 software developers and data experts.

Can someone explain this ISNULL sentence for me?...

Hi
I am working with rowfilters in dataviews.
I would like to filter for empty fields (= null value in the database)
I found this sentence on msdn:
****************
To return only those columns with null values, use the following expression:
"Isnull(Col1,'Null Column') = 'Null Column'"
*************************'
So I tried like this:
mainDataSource.RowFilter = "Gender = 'male' and " & "Isnull(floor,'Null
Column') = 'Null Column'"
And this actually works returning males that does not have a value in the
floor field.

But I do not understand why.
Isnull returns a boolean and does not take a column and a string. It looks
more like the NZ function from visual basic.

Can someone explain this to me?

Best regards

Jan
Nov 21 '05 #1
3 2018
Hi,

SQL statement that replaces a null with the specified value.
http://msdn.microsoft.com/library/de...ia-iz_6mek.asp

Ken
------------------
"Jan Nielsen" <Re**************@tiscali.dk> wrote in message
news:ef**************@TK2MSFTNGP11.phx.gbl...
Hi
I am working with rowfilters in dataviews.
I would like to filter for empty fields (= null value in the database)
I found this sentence on msdn:
****************
To return only those columns with null values, use the following expression:
"Isnull(Col1,'Null Column') = 'Null Column'"
*************************'
So I tried like this:
mainDataSource.RowFilter = "Gender = 'male' and " & "Isnull(floor,'Null
Column') = 'Null Column'"
And this actually works returning males that does not have a value in the
floor field.

But I do not understand why.
Isnull returns a boolean and does not take a column and a string. It looks
more like the NZ function from visual basic.

Can someone explain this to me?

Best regards

Jan

Nov 21 '05 #2
Hi Ken
Thanks for answering
Well at least it clarified one thing: isnull is a sql function. I looked in
the help for the vb functions.
It works very much like the nz function in vb.

But still...
If a datarow has a dbnull value I would expect the filter to become
something like this then:
mainDataSource.RowFilter = "Gender = 'male' and " 'Null Column' = 'Null
Column'"

Obviously this is incorrect as the column floor is not mentioned at all and
the last part will evaluate to true so gender = 'male' and TRUE.

I still do not get it

Jan

"Ken Tucker [MVP]" <vb***@bellsouth.net> skrev i en meddelelse
news:Ox**************@TK2MSFTNGP12.phx.gbl...
Hi,

SQL statement that replaces a null with the specified value.
http://msdn.microsoft.com/library/de...ia-iz_6mek.asp

Ken
------------------
"Jan Nielsen" <Re**************@tiscali.dk> wrote in message
news:ef**************@TK2MSFTNGP11.phx.gbl...
Hi
I am working with rowfilters in dataviews.
I would like to filter for empty fields (= null value in the database)
I found this sentence on msdn:
****************
To return only those columns with null values, use the following
expression:
"Isnull(Col1,'Null Column') = 'Null Column'"
*************************'
So I tried like this:
mainDataSource.RowFilter = "Gender = 'male' and " & "Isnull(floor,'Null
Column') = 'Null Column'"
And this actually works returning males that does not have a value in the
floor field.

But I do not understand why.
Isnull returns a boolean and does not take a column and a string. It looks
more like the NZ function from visual basic.

Can someone explain this to me?

Best regards

Jan

Nov 21 '05 #3
I'm back.
I kept thinking and now I think I understand it.
The filter will look at a row to see if gender is male. If so it will make
the isnull test for the floor column and if it is null it will return true
for this row (because 'null column' = 'null column' for this specific row)
which will then be included in the filter.

Is this about correct?

Jan

"Jan Nielsen" <Re**************@tiscali.dk> skrev i en meddelelse
news:%2********************@TK2MSFTNGP12.phx.gbl.. .
Hi Ken
Thanks for answering
Well at least it clarified one thing: isnull is a sql function. I looked
in the help for the vb functions.
It works very much like the nz function in vb.

But still...
If a datarow has a dbnull value I would expect the filter to become
something like this then:
mainDataSource.RowFilter = "Gender = 'male' and " 'Null Column' = 'Null
Column'"

Obviously this is incorrect as the column floor is not mentioned at all
and the last part will evaluate to true so gender = 'male' and TRUE.

I still do not get it

Jan

"Ken Tucker [MVP]" <vb***@bellsouth.net> skrev i en meddelelse
news:Ox**************@TK2MSFTNGP12.phx.gbl...
Hi,

SQL statement that replaces a null with the specified value.
http://msdn.microsoft.com/library/de...ia-iz_6mek.asp

Ken
------------------
"Jan Nielsen" <Re**************@tiscali.dk> wrote in message
news:ef**************@TK2MSFTNGP11.phx.gbl...
Hi
I am working with rowfilters in dataviews.
I would like to filter for empty fields (= null value in the database)
I found this sentence on msdn:
****************
To return only those columns with null values, use the following
expression:
"Isnull(Col1,'Null Column') = 'Null Column'"
*************************'
So I tried like this:
mainDataSource.RowFilter = "Gender = 'male' and " & "Isnull(floor,'Null
Column') = 'Null Column'"
And this actually works returning males that does not have a value in the
floor field.

But I do not understand why.
Isnull returns a boolean and does not take a column and a string. It
looks
more like the NZ function from visual basic.

Can someone explain this to me?

Best regards

Jan


Nov 21 '05 #4

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

Similar topics

2
by: Trev | last post by:
I have two tables, tblMTO and tblIMPORT_MTO. If I import an entire MTO into the import table I want to create a delta from it (i.e. leave only the changed items). I have a view (simplified) ...
8
by: Deano | last post by:
Here's the code; Private Sub txtTeachName_LostFocus() If IsNull(Me.txtName) Then 'line A Forms!frmMainform!frmSubform.Locked = True GoTo Exit_txtName Else 'line B...
8
by: huhu | last post by:
Hi, I meet a sentence: ------------------------------------------------ struct intNode *(*fpt)(void)= {createList, inNode, delNode,revNode,NULL};...
3
by: Jason luo | last post by:
Hi all, In c99-standard page 52,there is a sentence about void,as below: If an expression of any other type is evaluated as a void expression, its value or designator is discarded. I don't...
20
by: nicolas.riesch | last post by:
I try to understand strict aliasing rules that are in the C Standard. As gcc applies these rules by default, I just want to be sure to understand fully this issue. For questions (1), (2) and...
12
by: Andrew Ducker | last post by:
And no, this isn't a complaint about break - I'm very happy to make things explicit. However, why isn't the format something like: switch(myVariable) { case 1: { //Do Something
8
by: John | last post by:
What is the purpose / benefit of using an interface statement? It doesn't seem like anything more than a different way to make a class... (except you can't define any procedures in an interface...
4
by: jimm.sander | last post by:
Hello, Problem: Im using isnull() in vbscript to determine if a field returned from a ado object call is in fact null. The problem is when I use isnull in anything other than a response.write()...
40
by: aslamhenry | last post by:
please key in any 5 digits number : 56789 and the ouput is 5678 9 567 89 56 789 5 6789
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.