Skip to Content
0
Former Member
Apr 02, 2014 at 03:02 PM

Selecting data with SQL code acting differently in CR

18 Views

Hi,

I have a SQL Query containing the following codes:

cast(AROBP_A.IDINVC as int) as AROBP_A_IDINVC,

...

where AROBP_N.FISCYR = '2014' and AROBP_N.FISCPER = '07' and AROBP_N.IDINVC not like '[A-Z]%' and AROBP_N.IDINVC not like '%[A-Z]'

IDIINV is an Invoice "Number"; the "not like" clause is used to filter out non numeric data in order to convert from a string to a usable numeric, so I can link to another database where Invoice Numbers are of a numeric type.

The full query above selects 2087 rows.

When I copy this query into a CR command the cast statement fails, the error tells me it cannot cast alpha to type int.

When I remove the cast clause, it works fine, but picks the rows including alpha entries, a total of 2114 rows.

Is someone familiar with how I need to adjust the syntax for the "not like"s? It doesn't error, it just seems to ignore it.

Thanks!

MAtt