0
Select  
    CAST(
        CAST(N'' AS XML).value(
            'xs:base64Binary("MA==")'
          , 'VARBINARY(MAX)'
        ) 
        AS VARCHAR(MAX)
    )   ASCIIEncoding
;

Declare @Value nvarchar(10)
set @Value ='MA=='
Select  
    CAST(
        CAST(N'' AS XML).value(
            'xs:base64Binary("@Value")'
          , 'VARBINARY(MAX)'
        ) 
        AS VARCHAR(MAX)
    )   ASCIIEncoding
;

收到错误

4

1 回答 1

0

这有效:

Declare @Value nvarchar(10)
set @Value ='MA=='
Select  
    CAST(
        CAST(N'' AS XML).value(
            'xs:base64Binary(sql:variable("@Value"))'
          , 'VARBINARY(MAX)'
        ) 
        AS VARCHAR(MAX)
    )   ASCIIEncoding
;
于 2013-10-09T07:04:48.810 回答