Replace() and Space() Function in MS Access

1. Replace() Function :
In MS Access The Replace function will replace a substring by another substring with a specified number. In this function, the first parameter will be the string and the second parameter will be found (The substring to search for in string)  and the third parameter will be the replacement(The substring to replace find in the string) and fourth is optional is the starting point if not given then default it will be taken 1, fifth will be the count( number of replaces to perform), this will also optional.

Syntax :

Replace(string1, find, replacement, start, count) 

Example –

SELECT Replace("geeksforgeeks", "e", "i") AS ReplaceString;

Output –

ReplaceString
giiksforgiiks

Example –



SELECT Replace("geeksforgeeks", "g", "z", 4) AS ReplaceString;

Output –

ReplaceString
geeksforzeeks

2. Space() Function :
In MS Access, The Space function returns a string of the given number of space characters. A number will be pass as a parameter and it will return a string of the length of the given number and all characters will be space.

Syntax :

Space(number) 

Example –

SELECT len(Space(15)) AS SpaceString;

Output –

SpaceString
15

Example –

SELECT len(Space(10)) AS SpaceString;

Output –

SpaceString
10
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.