Commenting Out Definition Queries in ArcGIS Desktop?

Just a guess, but the reason commenting it out doesn't work is probably because a definition query is just the WHERE clause part of a larger SQL statement built internally by ArcGIS whenever it needs to query the underlying database, for example to draw the layer. When you add the comment characters, ArcGIS still adds the WHERE clause and the underlying DB freaks because it's not valid SQL.

On the Query Builder dialog there are load and save buttons. Save creates a .exp file that you can then load back in with the Load button. It's a few more clicks than you are probably looking for but it's something.


The block comment /../ seems to work as long as you have something in your definition query. If you comment everything out, you need to put a 1=1 before your commented out lines

Examples:

All commented out:

1=1  
/*  
  and ASSIGNMENT_STATUS <> 'Closed' 
  and DEVICE_TYPE = 'device'     
  and ASSIGNED_TO = 'somebody'    
*/

1 uncommented, 2 commented out:

ASSIGNMENT_STATUS <> 'Closed' 
/* 
  and DEVICE_TYPE = 'device'     
  and ASSIGNED_TO = 'somebody'    
*/

2 uncommented, 1 commented out:

ASSIGNMENT_STATUS <> 'Closed' 
DEVICE_TYPE = 'device'
/*      
  and ASSIGNED_TO = 'somebody'    
*/

Just move the "/" and "/" around.