conversion of an integer to string in SQL query

1303
2
09-25-2012 06:55 AM
MattFrancis
New Contributor III
Hey All,

I am joining a table to my SQL database, and trying to determine if two values are equal, but I am having a hard time with this comparison

database.testing.PARCELS.PID <> PARCELS_SpatialJoin1.PID

The first value is text, the second is an integer.  In the Select By Attributes dialog box, how do I make this work?
0 Kudos
2 Replies
ShaunLam
New Contributor III
Create a new field as Text, field calculate that field as the integer field. Re run the select by attributes with the 2 text fields.
0 Kudos
FabianBlau
Occasional Contributor II
These sites will probably help:
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s500000033000000
http://msdn.microsoft.com/en-us/library/aa226054%28SQL.80%29.aspx

So try (the parameter for varchar is the size of your text-field, maybe 50):
database.testing.PARCELS.PID <> CAST(PARCELS_SpatialJoin1.PID AS varchar(50))
0 Kudos