Asterisk RealTime and slash matching

we are trying to configure our Asterisk to work with MySQL database to store it’s extensions and sip configuration. We want certain action on extension to be executed only based on Caller ID. This is normally done in extensions.conf file like this:

It should set CallerID to 42 whenever outgoing call is placed, but only if CallerID is 1000 (the “/1000” part). When we place this in extensions.conf, it works as expected. When we, however, put it into database like this:

+----+---------+----------+----------+-----+------------------+ | id | context | exten | priority | app | appdata | +----+---------+----------+----------+-----+------------------+ | 4 | default | _X./1000 | 1 | SET | CALLERID(num)=42 | +----+---------+----------+----------+-----+------------------+
It seems to completely ignore anything behind the slash, setting Caller ID to 42 for every outgoing call.

Is there a way to achieve the same behavior with database as with extensions.conf?
Thank you for your help,

So, apparently, it is not possible to do the same thing in database. However, we were able to find a workaround for the thing we needed. We are now using ODBC_SQL (and our custom ODBC functions defined in func_odbc.conf) to accomplish what we were trying to do.
For example, to set a caller ID based on database table, you can use the following setting:

+----+---------+------------+----------+-----+---------------------------------------------------------------------------+----------+------+ | id | context | exten | priority | app | appdata | category | note | +----+---------+------------+----------+-----+---------------------------------------------------------------------------+----------+------+ | 3 | default | _1234567XX | 1 | SET | CALLERID(num)=${ODBC_SQL(select internal_set_callerid(${CALLERID(num)}))} | internal | NULL | +----+---------+------------+----------+-----+---------------------------------------------------------------------------+----------+------+
where database function internal_set_callerid can be easily replaced by simple select.