Delete a field if it's empty for every record

Build your list of AccuZIP6 commands by requesting commands and sharing commands with other users

Moderators: Chrissy, Steve, Terry, Donna, Dave, Eric, MartyH, Kristen, Geoff, Vince

Post Reply
User avatar
Eric
Moderator
Posts: 1910
Joined: Tue Sep 19, 2006 3:29 pm
Contact:

Delete a field if it's empty for every record

Post by Eric » Thu Jan 03, 2008 9:20 am

The command below will delete the Address2 field whenever that field has no data in it for every record in the database.

Code: Select all

com_field="ADDRESS2"
COUNT FOR !EMPTY(&com_field) TO com_emptycount
com_deletefield=IIF(com_emptycount=0,"ALTER TABLE (ALIAS()) DROP COLUMN &com_field","")
&com_deletefield
Chat with an AccuZIP6 technician weekdays from 7-4 PST with AccuZIP6 Live Online Support

Post Reply