- Categories:
String & binary functions (Encoding/Decoding)
BASE64_DECODE_STRING¶
Decodes a Base64-encoded string to a string.
Syntax¶
Arguments¶
Required:
inputA Base64-encoded string expression.
Optional:
alphabetA string consisting of up to three ASCII characters:
The first two characters in the string specify the last two characters (indexes 62 and 63) in the alphabet used to encode the input:
AtoZ(indexes 0-25)atoz(indexes 26-51)0to9(indexes 52-61)+and/(indexes 62, 63)
Defaults:
+and/The third character in the string specifies the character used for padding.
Default:
=
Returns¶
A string.
Usage notes¶
The characters in the
alphabetstring are positionally parsed; to specify different characters in the second or third positions in the string, you must explicitly specify all preceding characters even if you wish to use the defaults.For example:
+$specifies the default (+) for index 62 and a different character ($) for index 63; no character is explicitly specified for padding so the default character (=) is used.+/%specifies the defaults (+and/) for indexes 62 and 63, and specifies a different character (%) for padding.
The
alphabetstring used to decodeinputmust match the string originally used to encodeinput.
For more information about base64 format, see base64.
Examples¶
This shows a simple example of using BASE64_DECODE_STRING:
This shows another example of using BASE64_DECODE_STRING:
Create a table and data:
Now run a query using
BASE64_DECODE_STRING: