title: SQL Server/Dynamics CRM: How to read document body from Annotation Base using SQL only
body: <p>I am building an SSRS report in which I need to read parts of a MS Word Document body that contains some error logs.  The document body is stored in the AnnotationBase in SQL Server.  Per Scott Durow (MVP), </p>
  
  <blockquote>
    <p>"The DocumentBody is a base64 encoded string, so you'll need to
    convert back to binary and save to a file."</p>
  </blockquote>
  
  <p><a href="https://community.dynamics.com/crm/f/117/t/185391" rel="nofollow noreferrer">https://community.dynamics.com/crm/f/117/t/185391</a></p>
  
  <p>I am aware there is a converter and have also tried the following using SQL:</p>
  
  <p><a href="https://blogs.msdn.microsoft.com/sqltips/2008/06/30/converting-from-base64-to-varbinary-and-vice-versa/" rel="nofollow noreferrer">https://blogs.msdn.microsoft.com/sqltips/2008/06/30/converting-from-base64-to-varbinary-and-vice-versa/</a></p>
  
  <p>However the solution in the above link did not work.</p>
  
  <p>I am aware this can easily done using C#.  However, this is the only snag I have ran into building the report and would like to keep it all SQL.</p>
  
  <p>Is this possible without me having to right a .NET component?  If not, can this be done using FetchXML?</p>