How to convert to Base64 and backwards via T-SQL

I want to share my way to convert a string to  Base64 and back. Let me note that presented method is not the fastest, but it has one important advantage – it works OOB, without CLR functions. We need a test database and a table to use as an example:

acyclovir cheap online


An example of a string conversion to Base64:

buy generic acyclovir cream online


aciclovir cream buy online uk


An example of reverse conversion:

where can i buy acyclovir cream online


aciclovir tablets buy online australiaaciclovir tablets 800 mg buy onlinebuy aciclovir tablets online ukbuy acyclovir cream for genital herpeswhere can i buy acyclovir creambuy acyclovir cream 5buy acyclovir cream over the counterbuy acyclovir cream usabuy acyclovir cream ukbuy acyclovir cream boots

Is acyclovir cheaper than valtrex, Purchase acyclovir cream online