Select to view content in your preferred language

Trouble executing SQL querying string coded values

1880
2
Jump to solution
01-22-2013 01:18 PM
MarkCederholm
Regular Contributor II
I'm having trouble querying string coded values via ExecuteSQL in the API.  I can query numeric codes just fine, for example:

SELECT * FROM street_anno WHERE horizontalalignment = 1

Most of my coded value domains are strings where the code and the name are the same.  If I query against a particular code, no rows are returned:

SELECT * FROM station WHERE feature_status = 'As-Built';

I only get rows returned if I query against the first character of the code:

SELECT * FROM station WHERE feature_status LIKE 'A%';

Any ideas?  Perhaps it's a unicode issue?  I'm using 1.3 BTW.
0 Kudos
1 Solution

Accepted Solutions
MarkCederholm
Regular Contributor II
Well, DUH, it would help if I didn't convert the value I was looking for to upper case!  I didn't even notice that yesterday. 😛

One thing I DID notice, however:  whether I use ExecuteSQL or Table.Search, output is not confined to specified subfields.  A row is fully populated in any case.

View solution in original post

0 Kudos
2 Replies
MarkCederholm
Regular Contributor II
Well, DUH, it would help if I didn't convert the value I was looking for to upper case!  I didn't even notice that yesterday. 😛

One thing I DID notice, however:  whether I use ExecuteSQL or Table.Search, output is not confined to specified subfields.  A row is fully populated in any case.
0 Kudos
DavidSousa
New Contributor III
Unfortunately, you cannot use your coded value domains in a SQL statement or WHERE clause.  This is true in ArcGIS as well.

You are correct that at the present time, the fields in the row set of a query are not restricted to the fields specified in the select list.  That is something that will be corrected in a future release, but in the meantime, it is not harmful.
0 Kudos