conversion of an integer to string in SQL query

09-25-2012 06:55 AM
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
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
Occasional Contributor II
These sites will probably help:

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