Mid() and Len() Function in MS Access
1. Mid() function :
In MS Access the mid() function will extract the string from a given position. In this function 3 parameters will be passed first will be the string and second will be the starting position and last will be the length of the string.
Syntax :
Mid(string, start, length)
Example-1 :
SELECT Mid("w3wiki", 3, 3) AS ExtractString;
Output –
ExtractString |
EKS |
Example-2 :
SELECT Mid("w3wiki", 6, 14) AS ExtractString;
Output –
ExtractString |
FORBeginner |
2. Len() function :
In MS Access the Len() function will return the length of the string. It will take the string as a parameter and it will return the length of the string.
Syntax :
Len(string/varname)
Example-1 :
SELECT Len("w3wiki") AS LengthOfString;
Output –
LengthOfString |
13 |
Example-2 :
SELECT Len("GFG") AS LengthOfString;
Output –
LengthOfString |
3 |