473,662 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,'N ull 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 2033
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******** ******@TK2MSFTN GP11.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,'N ull 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***@bellsout h.net> skrev i en meddelelse
news:Ox******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP11.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,'N ull 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******** ************@TK 2MSFTNGP12.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***@bellsout h.net> skrev i en meddelelse
news:Ox******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP11.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,'N ull 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
13958
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) SELECT dbo.tblIMPORT_MTO.ImportID, dbo.tblIMPORT_MTO.MTONo, dbo.tblIMPORT_MTO.Rev AS New_Rev, dbo.tblMTO.Rev AS Old_Rev FROM dbo.tblIMPORT_MTO LEFT OUTER JOIN dbo.tblMTO ON dbo.tblIMPORT_MTO.MTONo = dbo.tblMTO.MTONo Now to get all rows...
8
1433
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 Forms!frmMainform!frmSubform.Locked = False 'line C
8
1302
by: huhu | last post by:
Hi, I meet a sentence: ------------------------------------------------ struct intNode *(*fpt)(void)= {createList, inNode, delNode,revNode,NULL}; ------------------------------------------------- The "createList","inNode","delNode","revNode" are functions. I'm puzzled by the c sentence. Who can explain it for me? Thanks!
3
5679
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 know how to understand it, How to evaluate the expression as a void expression? explicit conversion the expression? but, befor the sentence ,"implicit or explicit conversions (except to void) shall not
20
3752
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 (3), I think that the answers are all "yes", but I would be glad to have strong confirmation. About questions (4), (5) and (6), I really don't know. Please help ! ! !
12
1460
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
1773
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 like you can do in a class). I'm obviously missing something... John
4
5088
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() I get the following error: Error Type: ADODB.Recordset (0x800A0CC1) Item cannot be found in the collection corresponding to the requested name or ordinal.
40
2307
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
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8344
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.