Skip to main content
Solved

WHERE clause - exclude null values

  • August 23, 2022
  • 2 replies
  • 475 views

Please can someone tell me how to write a WHERE clause in the feature reader that excludes records that do not contain a value.

  • I have thousands of records and some of them have a Global ID - I want to keep these records.
  • I also have records that contain NULL or no value - I want to exclude these values.

I can perform this function in a Tester, but a colleague informed me having this clause built in to the feature reader instead will be much quicker. Perhaps someone can confirm this.

Thanks, Frank

Best answer by chriswilson

If you're talking SQL (or geodatabase SDE or file geodatabase readers) then try:

WHERE your_column <> ' ' AND your_column IS NOT NULL

 

Seemingly you don't need the AND/onwards part but if you want to be explicit then you can include it.

https://stackoverflow.com/questions/8660203/how-to-check-for-is-not-null-and-is-not-empty-string-in-sql-server.

 

Your colleague is correct that using this will be quicker as it will avoid reading records you don't need into memory.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

chriswilson
Enthusiast
Forum|alt.badge.img+21
  • Enthusiast
  • Best Answer
  • August 24, 2022

If you're talking SQL (or geodatabase SDE or file geodatabase readers) then try:

WHERE your_column <> ' ' AND your_column IS NOT NULL

 

Seemingly you don't need the AND/onwards part but if you want to be explicit then you can include it.

https://stackoverflow.com/questions/8660203/how-to-check-for-is-not-null-and-is-not-empty-string-in-sql-server.

 

Your colleague is correct that using this will be quicker as it will avoid reading records you don't need into memory.


If you're talking SQL (or geodatabase SDE or file geodatabase readers) then try:

WHERE your_column <> ' ' AND your_column IS NOT NULL

 

Seemingly you don't need the AND/onwards part but if you want to be explicit then you can include it.

https://stackoverflow.com/questions/8660203/how-to-check-for-is-not-null-and-is-not-empty-string-in-sql-server.

 

Your colleague is correct that using this will be quicker as it will avoid reading records you don't need into memory.

Thanks Chris. This has done the trick, much appreciated.