If you intend to keep the Base64 string as is, you can use the VARCHAR data type. Base64 encoding was designed to use only 7-bit ASCII characters.
However, if you prefer to store your data in binary format, you will need to use the VARBINARY data VARBINARY and convert the Base64 string to binary. You can use the XQuery functionality (starting with SQL Server 2005) to easily convert values ββto VARBINARY and vice versa.
Converting a Base64 value to a variable in VARBINARY :
declare @str varchar(20); set @str = '3qAAAA=='; select cast(N'' as xml).value('xs:base64Binary(sql:variable("@str"))', 'varbinary(20)');
Converting a binary value to a variable in Base64:
declare @bin varbinary(20); set @bin = 0xDEA00000; select cast(N'' as xml).value('xs:base64Binary(xs:hexBinary(sql:variable("@bin")))', 'varchar(20)');
Source (and other examples): Converting from Base64 to varbinary and vice versa .
source share