+ Start a Discussion
dev_forcedev_force 

Query for records with Name starting with a number

Is it safe to use:

 

SELECT Id, Name FROM Account WHERE Name < 'a' ?

 

 

It seems to work... and returns accounts with names like:

$123abc

84888

20-20 Inc

 

kerwintangkerwintang

It's safe to use, however it also retrieves Names with non-numeric starting characters.

 

To get starting with numbers only, i'd use the query below:

 

SELECT Id, Name FROM Account WHERE (Name <='9' and Name >='0') or Name like '9%'

 

Best Regards,

Kerwin

 

dev_forcedev_force

Thanks for the reply.

 

Which non-numeric starting characters will it return?

kerwintangkerwintang

It will be those characters with ascii value < ascii value of "A".

 

In summary, the ff. are the said chars:

!"#$%&'()*+,-./0123456789:;<=>?@

 

These characters are between the ascii values of "Z" and "a":

[\]^_`

 

 

These characters are after the ascii value of "z":

{|}~

 

Hope this helps.

 

Regards,

Kerwin