Base64 encoding in SQL Server 2005 T-SQL

后端 未结 10 823
傲寒
傲寒 2020-11-22 10:06

I\'d like to write a T-SQL query where I encode a string as a Base64 string. Surprisingly, I can\'t find any native T-SQL functions for doing Base64 encoding. Does a nativ

10条回答
  •  花落未央
    2020-11-22 10:33

    You can use just:

    Declare @pass2 binary(32)
    Set @pass2 =0x4D006A00450034004E0071006B00350000000000000000000000000000000000
    SELECT CONVERT(NVARCHAR(16), @pass2)
    

    then after encoding you'll receive text 'MjE4Nqk5'

提交回复
热议问题