Support 805.461.7300
Sales
Our Technology. Your Success.

Delete a field if the field is blank for all records

Here is the command to delete a field (column) from the database if all of the records are blank in that field.

*!* Get Field Name
com_FieldName="myField"

*!* Count records that are not empty
COUNT FOR !EMPTY(&com_FieldName) TO com_Count

*!* Create a Delete Column String if Count is 0
com_AlterString=IIF(com_Count=0,[ALTER TABLE (ALIAS()) DROP COLUMN &com_FieldName],[])

*!* Run AlterString line
&com_AlterString

« Back to Commands

While we have consistently been impressed with the level of assistance we receive through your online chat portal, Geoff has been more than helpful and great to work with on every issue we’ve come across. He is quick to diagnose and resolve the issues. He also has offered to instruction and information to prevent future issues. He has even guided us through some functions of Accuzip we had not previously been utilizing. I wanted to take a minute and give a huge shout out to Geoff.
T.A., Grand Rapids, MI