I'm trying to write a dynamic SOQL query to get an object's record that has numeric value in a particular field. I'm trying to do something similar like below:
Account acc;
queryString = 'SELECT Id,Name FROM Account WHERE Name like \'%[^0-9]%\' ORDER BY Name DESC limit 1';
acc = Database.query(queryString);
I do have an account with name = 123456 in my developer edition. But I'm getting error
"List has no rows for assignment to SObject"
In SQLServer we can use isnumeric() in the where clause to get the records with numeric values. Is there any similar function or alternative approach in SOQL to acheive this? Can anyone please help me?
Thanks in advance.