How To: Cast a number to a string using SQL
In some scenarios (such as using select by attributes or a definition query) a string operation might be necessary, but if the data is a number type it does not work. This article provides a sample of how to cast the number field to a string for a SQL operation.
This code casts the number field "SQLNUM" as a text field, which can then be used in a text operation.
CAST( "SQLNUM" AS CHARACTER(12))
The following is an example of how it can be implemented to combine a text field and an number field in a SQL operation. This example selects the fields that are not identical between a text field and a number field:
CAST( "SQLNUM" AS CHARACTER(12)) <> "SQLTEXT"