Using input parameters in where clause properly

Discussion created by eike619 on Oct 31, 2012
Latest reply on Apr 23, 2013 by dmasante
Greetings to GIS community,

I am fairly new with this and I've got a (probably simple) problem with using the right syntax in a where_clause and hope somebody can help me. The script should compare 2 tables after selecting specific attributes. I want the User to fill in the parameters he wants to compare (by GetParameterAsText)
Here is a short extract of the script:

LAND_CD = arcpy.GetParameterAsText(0)
WA_CD = arcpy.GetParameterAsText(1)
WB_CAT = arcpy.GetParameterAsText(2)
DE_MEAS_CD = arcpy.GetParameterAsText(3)

test_msrprog_2009 = r"Y:\GIS\\Temp_GIS\\Scratch_GeoDB.gdb\\test_msrprog_2009"
test_msrprog_2012 = r"Y:\GIS\\Temp_GIS\\Scratch_GeoDB.gdb\\test_msrprog_2012"
query_test_msrprog_2009 = r"Y:\GIS\\Temp_GIS\\Scratch_GeoDB.gdb\\query_test_msrprog_2009"

newLAND_CD = arcpy.AddFieldDelimiters(test_msrprog_2009, LAND_CD)
newWA_CD = arcpy.AddFieldDelimiters(test_msrprog_2009, WA_CD)
newWB_CAT = arcpy.AddFieldDelimiters(test_msrprog_2009, WB_CAT)
newDE_MEAS_CD = arcpy.AddFieldDelimiters(test_msrprog_2009, DE_MEAS_CD)

where = "\"LAND_CD\" = newLAND_CD AND \"WA_CD\" = newWA_CD  AND \"WB_CAT\" = newWB_CAT AND \"DE_MEAS_CD\" = newDE_MEAS_CD"

# Process: Table Select (3)
arcpy.TableSelect_analysis(test_msrprog_2009, query_test_msrprog_2009, where)

LAND_CD and WB_CAT are String.
WA_CD and DE_MEAS_CD are Double.

The whole Script works, if i fill my values in the code manually. But not with "GetParameterAsText", then i get ERROR 000714.
I think failure must be inside that where_clause.