2 Replies Latest reply on Feb 3, 2015 10:07 AM by bluefunelemental

    Property is Null

    jmazaredo

      Is there a way that I can get this query working, the query is giving empty result.

       

      Select Region,SITECODE,CAPTION,Device_Type,MachineType,Notification from nodes WHERE Notification = '' Doesnt work

      Select Region,SITECODE,CAPTION,Device_Type,MachineType,Notification from nodes WHERE Status = '2' Works

        • Re: Property is Null
          mharvey

          If you are looking for items that have not had something in Notification then you want

           

          where Notification IS NULL

           

          If there were values that have been blanked out then you want

           

          where Notification = ' ' to denote an empty space. 

           

          From what you have above then more than likely the IS NULL is what you are looking for.

          • Re: Property is Null
            bluefunelemental

            Agree with mharvey

            Though some queries will fail because your operator does not like coming across NULL values. In which case you can use the IsNull function like this:

            Select Region,SITECODE,CAPTION,Device_Type,MachineType,Notification from nodes WHERE IsNull(Environment,'') = 'Production'

            Would return any nodes where the environment value is Production and not break on NULLS

            Whereas

            Select Region,SITECODE,CAPTION,Device_Type,MachineType,Notification from nodes WHERE IsNull(Environment,'') = 'Production'

            Would return any nodes where the environment value is Production or NULL, as we are substituting Production for NULLS

            Or the one I have to use all the time

            Select Region,SITECODE,CAPTION,Device_Type,MachineType,Notification from nodes WHERE IsNull(Environment,'') = ''

            Show me all the nodes whose environment value is empty string or NULL

            1 of 1 people found this helpful