Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL to select left character if a number but not a letter
Message
 
 
To
All
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
SQL to select left character if a number but not a letter
Miscellaneous
Thread ID:
00617582
Message ID:
00617582
Views:
86
Hello everyone,
I have a field in a table that consists of both numbers and letters. I would like to have a SQL statement that will select the first character in that field and if it is greater than "2" then show the number otherwise show "0". The SQL I use now does that but if there is a letter as the first character access shows it as '#Error' but I would like it to show "0" if it is a letter or number less than 2. This is the SQL I have tried:

SELECT Iif(Left([myField],1)>2, Left([myField],1),"0")
FROM MyTable;

Can anyone please help with this SQL statement?
Thank you!
Max
Next
Reply
Map
View

Click here to load this message in the networking platform