<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: query syntax problem in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/query-syntax-problem/qaa-p/13844330#M4875173</link>
    <description>&lt;P&gt;Sorry, my last sentence was misleading. SIMILAR TO and REGEXP do not use flags but I guess the .NET RegexOptions flags can be expressed with according patterns and/or the different behaviour of SIMILAR TO vs. REGEXP - e.g. SIMILAR TO uses the database collation (and therefore will use "ignore case" semantics in a case insensitive database) whereas REGEXP will use case sensitive semantics - cf. &lt;A href="http://dcx.sybase.com/index.html#1201/en/sachanges/new1101-s-3634293.html*d5e10073"&gt;this overview from the v11.0.1 "What's New" pages&lt;/A&gt;...&lt;/P&gt;</description>
    <pubDate>Fri, 29 Aug 2014 04:11:56 GMT</pubDate>
    <dc:creator>VolkerBarth</dc:creator>
    <dc:date>2014-08-29T04:11:56Z</dc:date>
    <item>
      <title>query syntax problem</title>
      <link>https://community.sap.com/t5/technology-q-a/query-syntax-problem/qaq-p/13844325</link>
      <description>&lt;P&gt;I got syntax error at end of the query near ; SQLCODE=-131, ODBC 3 State='42000'
I believe the error stems from using ...dba.$Regex_Match(...&lt;/P&gt;
&lt;PRE class="codehilite"&gt;&lt;CODE&gt;begin
declare @excludeSubAcctAliasRegexPatternLst long varchar;
declare @acct_id int;
set @excludeSubAcctAliasRegexPatternLst='test';
set @acct_id=1;
select subAcct_ID, acct_type_short_name 
from dba.subAcct where acct_id = @acct_id
            or  not dba.$Regex_Match(acct_type_short_name, @excludeSubAcctAliasRegexPatternLst);

end


&lt;P&gt;where dba.$Regex_Match is defined as &lt;/P&gt;
&lt;/CODE&gt;&lt;PRE class="codehilite"&gt;&lt;CODE&gt;&lt;CODE&gt;ALTER FUNCTION "dba"."$Regex_Match"( in @str2Match long varchar,in @regexPattern long varchar ) 
returns bit not deterministic
external name 'Q:\\\\SqlAnywhereExtEnv\\\\SqlAnywhereDotNetDll.dll::SqlAnywhereDotNetDll.Util.regexMatch( string, string) bool' language CLR


&lt;P&gt;and the corresponding clr member is&lt;/P&gt;
&lt;/CODE&gt;&lt;/CODE&gt;&lt;PRE class="codehilite"&gt;&lt;CODE&gt;&lt;CODE&gt;&lt;CODE&gt;    public static bool regexMatch(string s, string pattern)
{
    try { return Regex.IsMatch(s, pattern, roIcEc); }
    catch { }
    return false;
}


&lt;P&gt;I have used successfully other members from the dll for clr proc. this is my first time  using clr function.&lt;/P&gt;&lt;/CODE&gt;&lt;/CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Aug 2014 01:27:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/query-syntax-problem/qaq-p/13844325</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-08-28T01:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: query syntax problem</title>
      <link>https://community.sap.com/t5/technology-q-a/query-syntax-problem/qaa-p/13844326#M4875169</link>
      <description>&lt;P&gt;I think the error comes from the fact that you treat the bit datatype as a boolean value which is not valid in SQL Anywhere - cf. that sample which also raises -131 (SQLE_SYNTAX_ERROR):&lt;/P&gt;
&lt;PRE class="codehilite"&gt;&lt;CODE&gt;begin
   declare b bit = 0;
   select * from sys.dummy where not b;
end;


&lt;P&gt;In contrast, the following comparison with 0 or 1 will work:&lt;/P&gt;
&lt;/CODE&gt;&lt;PRE class="codehilite"&gt;&lt;CODE&gt;&lt;CODE&gt;begin
   declare b bit = 0;
   select * from sys.dummy where b = 0;
end;


&lt;P&gt;So I guess you just might have to change the second condition to "...or dba.$Regex_Match(acct_type_short_name, @excludeSubAcctAliasRegexPatternLst) = 0"&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;FWIW, there's not boolean datatype in SQL Anywhere.&lt;/P&gt;&lt;/CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Aug 2014 03:35:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/query-syntax-problem/qaa-p/13844326#M4875169</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2014-08-28T03:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: query syntax problem</title>
      <link>https://community.sap.com/t5/technology-q-a/query-syntax-problem/qaa-p/13844328#M4875171</link>
      <description>&lt;P&gt;Aside: You might also use SQL Anywhere's &lt;A href="http://dcx.sybase.com/index.html#1201/en/dbreference/rf-sqllanguage-s-3888756.html"&gt;builtin regular expression support&lt;/A&gt;, i.e. SIMILAR TO and/or REGEXP, and note, those &lt;EM&gt;can&lt;/EM&gt; be used as boolean values, i.e.&lt;/P&gt;
&lt;PRE class="codehilite"&gt;&lt;CODE&gt;...or acct_type_short_name NOT SIMILAR TO @excludeSubAcctAliasRegexPatternLst


&lt;P&gt;I guess the .NET RegexOptions can be mapped to according patterns/flags.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Aug 2014 04:49:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/query-syntax-problem/qaa-p/13844328#M4875171</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2014-08-28T04:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: query syntax problem</title>
      <link>https://community.sap.com/t5/technology-q-a/query-syntax-problem/qaa-p/13844329#M4875172</link>
      <description>&lt;P&gt;thx &lt;/P&gt;
&lt;P&gt;I failed to find flags for clr compatiabiilty of regex in silmilar to and regexp for SA 11... ( found the online &lt;A href="http://syntax:http://dcx.sybase.com"&gt;syntax:http://dcx.sybase.com&lt;/A&gt;/1101/en/dbreference_en11/rf-sqllanguage-s-4915351.html)&lt;/P&gt;
&lt;P&gt;if you wonder why clr regex match, the filter is actually a list of ansi like expression reformatted as regex&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2014 12:22:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/query-syntax-problem/qaa-p/13844329#M4875172</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-08-28T12:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: query syntax problem</title>
      <link>https://community.sap.com/t5/technology-q-a/query-syntax-problem/qaa-p/13844327#M4875170</link>
      <description>&lt;P&gt;To restate Volker's correct answer: bool maps to BIT in SQL Anywhere, and BIT is an integer data type, NOT a boolean TRUE/FALSE or TRUE/FALSE/UNKKNOWN datatype. There is no boolean data type for variables in SQL Anywhere. Predicates (comparisons) can return boolean values, of course, but you cannot store or pass around those values.&lt;/P&gt;
&lt;P&gt;Perhaps you can code it this way...&lt;/P&gt;
&lt;P&gt;or  not ( dba.$Regex_Match(acct_type_short_name, @excludeSubAcctAliasRegexPatternLst) = 1 )&lt;/P&gt;
&lt;P&gt;if 1 is the true bool value that is mapped to integer bit (I don't know, you tell me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2014 16:19:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/query-syntax-problem/qaa-p/13844327#M4875170</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2014-08-28T16:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: query syntax problem</title>
      <link>https://community.sap.com/t5/technology-q-a/query-syntax-problem/qaa-p/13844330#M4875173</link>
      <description>&lt;P&gt;Sorry, my last sentence was misleading. SIMILAR TO and REGEXP do not use flags but I guess the .NET RegexOptions flags can be expressed with according patterns and/or the different behaviour of SIMILAR TO vs. REGEXP - e.g. SIMILAR TO uses the database collation (and therefore will use "ignore case" semantics in a case insensitive database) whereas REGEXP will use case sensitive semantics - cf. &lt;A href="http://dcx.sybase.com/index.html#1201/en/sachanges/new1101-s-3634293.html*d5e10073"&gt;this overview from the v11.0.1 "What's New" pages&lt;/A&gt;...&lt;/P&gt;</description>
      <pubDate>Fri, 29 Aug 2014 04:11:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/query-syntax-problem/qaa-p/13844330#M4875173</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2014-08-29T04:11:56Z</dc:date>
    </item>
  </channel>
</rss>

