Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL to select left character if a number but not a letter
Message
 
À
Tous
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Titre:
SQL to select left character if a number but not a letter
Divers
Thread ID:
00617582
Message ID:
00617582
Vues:
87
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform