AnsweredAssumed Answered

SQL Expression help, Select_Analysis

Question asked by clclark on Mar 6, 2013
Latest reply on Mar 7, 2013 by Caleb1987
In my code below, I am attempting to select features that have meet this Criteria : SNAP_FLAG (this is a field) < 3. Then I want to export these selected features as a new feature class.
# Import arcpy module
import arcpy, sys, traceback
arcpy.env.overwriteOutput = True
from os import path as p


arcpy.env.workspace = r"G:\ChrisGIS\PS_Steelhead\Work"
try:
    for ws in arcpy.ListWorkspaces("*", "FileGDB"):
        arcpy.env.workspace = ws
        print '\n\nSearching in %s\n\n' %ws
#
# Define Variables
        NB = p.join(ws, 'NB')
        NB_out = p.join(ws, 'NB_Snapped')
#
# Figure out Query Statement enter here 
        query = '"SNAP_FLAG" < \'3\''
#
# Select
        arcpy.Select_analysis(NB, NB_out, query)
        print 'NB_Snapped created from %s'%NB




I then get this error :
Error Info:
ERROR 999999: Error executing function.
An invalid SQL statement was used.
An invalid SQL statement was used. [NB]
The table was not found. [NB_Snapped]
Failed to execute (Select).


ArcPy ERRORS:
ERROR 999999: Error executing function.
An invalid SQL statement was used.
An invalid SQL statement was used. [NB]
The table was not found. [NB_Snapped]
Failed to execute (Select).

Any ideas what I am doing wrong? Is it the actual output table variable that is messed up, or is it my query...

Outcomes