Retrieve characters from a string, starting at the third position.
SELECT Mid(“SQL Tutorial”, 3) AS ExtractString; |
The Mid() function retrieves a specified number of characters from a string, starting from any position within the string.
Mid(string, start, length) |
Parameter |
Description |
string |
Required. Specifies the string from which characters will be extracted. |
start |
Required. Specifies the starting position from which to begin extracting characters from the string. |
length |
Optional. Specifies the number of characters to extract from the string. If omitted, the function returns all characters from the start position to the end of the string. |
Works in: |
From Access 2000 |
Extract characters from the text in a column, starting at the fourth position and extracting a total of six characters.
SELECT Mid(CustomerName, 4, 6) AS ExtractString FROM Customers; |