Loading ...
Sorry, an error occurred while loading the content.

4886Base 64 to Text Cast Error

Expand Messages
  • Charles Carroll
    Mar 10 7:02 AM
    • 0 Attachment
      Thanks to Eric Kestler for his help 2 weeks ago.

      the cast gives me the error:

      DP.docpage is a text field what should I cast it to so the below expression likes it?



      ****************************
      select top 1000
            
             DP.DocPageID
             --,DP.DocPage
             ,CAST(CAST(N'' AS XML).value('xs:base64Binary(DP.DocPage)', 'VARBINARY(MAX)') AS VARCHAR(MAX)) ASCIIEncoding
             ,D.Createdby_PersID
             ,N.NavURL
             ,N.NavLabel
             ,D.OriginSite_ID
            
             from DocPages DP
            
             inner join Documents D on DP.DocPageId=D.DocId
            
             --inner join Sites S
             --on D.OriginSite_id=S.Site_Code
            
             inner join NavSystems NS on D.OriginSite_ID=NS.OriginSite_ID
            
             inner join Navigation N on NS.NavSysID=N.NavSys_ID

      **************************

      The cast below works with a hard coded text value:

      CAST(

              CAST(N'' AS XML).value(

                  'xs:base64Binary("VGVzdERhdGE=")'

                , 'VARBINARY(MAX)'

              )

              AS VARCHAR(MAX)

          )   ASCIIEncoding
    • Show all 12 messages in this topic