title: T-SQL - Convert binary data to/from Base64 (or other string representation)
body: <p>Is there a Microsoft T-SQL statement that will allow you to convert a binary data type (like image) to/from a string representation like Base64.</p>
  
  <p>its easy enough in .net (Convert.ToBase64 &amp; Convert.FromBase64) but is this possible using SQL alone, something like (obviously pseudocode)</p>
  
  <pre><code>SELECT CastAsBase64(binary_field) As Base64BinaryField
  FROM   SomeTable
  WHERE  ID = @ID
  </code></pre>