To find and replace all null values in a specific column I am using:

case when "myColumn" is NULL then '99999999' else "myColumn" end

But how can I use the QGIS calculator to find and replace all null values in the multiple columns?

  • Do I understand correct: You want to execute the query (which you say is working as expected) for all columns of a layer? – Matthias Kuhn Sep 11 '13 at 9:12
  • I'm going to be a big old meanie here, and ask: are you sure you would ever want to do that? Using VERY_LARGE_NUM for unknown or invalid values is an old Fortran thing, and is used only by languages/systems which don't handle nulls properly. Could there ever be a time when you already legitimately had the value 99999999 in a column? Also, it's important that Null≠Null, but 99999999==99999999, so testing for unknowns will no longer work. If this is for output, dump to CSV and sed null to 99999999. Srsly; drop the P-38, can of worms ahead… – scruss Sep 11 '13 at 13:14
  • matthias Kuhn - yes thats is correct – Bwyss Sep 12 '13 at 7:25

That is currently not possible automatically in Field Calculator because these calculations can only affect one column.

Solutions would require python scripting.


You could always open the dbf-file (assuming you are working with a shape-file) directly in e.g. Open Office Calc (Excel doesn't handle dbf without problems...), select the columns of interest, and then run a simple find/replace within the selected columns.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.