base64 encode sql server
snippet in sql

base64 encode sql server

user4191

--String to Base64
SELECT CAST('string' as varbinary(max)) FOR XML PATH(''), BINARY BASE64

--Base64 to String
SELECT CAST( CAST( 'c3RyaW5n' as XML ).value('.','varbinary(max)') AS varchar(max) )