October 10, 2007 at 6:14 am
Comments posted to this topic are about the item BASE64 Encode and Decode in T-SQL
September 2, 2016 at 1:13 pm
I know this was posted a while ago, but its very useful when hacking Oracle WCC paths.
Thank you!
March 22, 2023 at 8:56 pm
Thank you very much for the contribution, it has helped me a lot.
Thank you!
March 23, 2023 at 12:58 pm
For posterity since 2012 the built-in method for converting to base64 is using XML. This comes up every now and then on SSC. The only post I could find tho was from Jonathon
From my SQL script of online stuff I found this example(which had to do with salting/unsalting a string)
declare
@salt char(36)=cast(newid() as char(36)),
@string char(36)=cast(newid() as char(36));
select @salt salt, @string string;
declare
@string_to_convert varchar(max)=concat(@salt, @string),
@binary_base64 varchar(max),
@unconverted_string varchar(max);
/* convert from varchar to binary base 64 (varchar) */
select @binary_base64=(select cast(@string_to_convert as varbinary(max)) for xml path(''), binary base64);
select @binary_base64 converted_string;
/* convert from binary base 64 (varchar) to varchar */
select @unconverted_string=(select cast(cast(@binary_base64 as xml).value('.','varbinary(max)') as varchar(max)));
select left(@unconverted_string, 36) salt, right(@unconverted_string, 36) string;
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy