title: Read binary data in TSQL through HTTP GET
body: <p>I need to export some images into my SQL Server through HTTP URL.</p>
  
  <p>I've found article about exporting of XML data:</p>
  
  <pre><code>sp_configure 'show advanced options', 1;
  GO
  RECONFIGURE;
  GO
  sp_configure 'Ole Automation Procedures', 1;
  GO
  RECONFIGURE;
  GO
  
  Declare @Object as Int; 
  Declare @ResponseText as Varchar(8000); 
  Declare @Url as Varchar(MAX); 
  select @Url = 'http://somexml.com/xmlfile.xml'
  
  Exec sp_OACreate 'MSXML2.XMLHTTP', @Object OUT; 
  Exec sp_OAMethod @Object, 'open', NULL, 'get', @Url, 'false' 
  Exec sp_OAMethod @Object, 'send' 
  Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT      
  Exec sp_OADestroy @Object 
  
  --load into Xml 
  Declare @XmlResponse as xml; 
  select @ResponseText
  </code></pre>
  
  <p>Also during research I've found that I should use <strong>ADODB.Stream</strong> for binary data. But I can't figure out how to read this object using approach described above. 
  Is there a way for reading binary data in pure TSQL or I should use CLR for this?</p>
  
  <p>Thanks a lot for helping.</p>