Hi, I am trying to add a definition query to all layers in an MXD that reside in an SDE database and not those that do not. The below code will add the definition query "RID = 111" to all layers in an MXD. How do I manipulate it to only add to those in my SDE database? I tried the wildcard but the names are all different so I was not able to get only the sde layers. Thanks.
import arcpy from arcpy import env env.workspace = "C:/WORKSPACE" mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd) CRID = 333 defquery = """ "RID" = """ + str(CRID) for lyr in arcpy.mapping.ListLayers(mxd): lyr.definitionQuery = defquery