HowTo:  Cast a number to a string using SQL

相关信息
Article ID: 41836
Software:
ArcGIS for Desktop Advanced 10.2
Platforms:
Windows Windows 8

问题描述
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"





    其它相关参考
    1. SQL reference for query expressions used in ArcGIS


    创建及修改时间
    Created: 12/2/2013

    Last Modified: 12/23/2013
    原文链接
    http://support.esri.com/en/kno ... 41836

    要回复问题请先登录注册