title: How to retrieve data from website to sql server [using sql]
body: <p>I have problem with one case related to retrieving data directly from website to sql database. 
  My data on website is a weather condition data for 2016(separated by comma). 
  I wrote some SQL procedure to download this data, but I received all data in one column. 
  Also when I call procedure once again I receive NULL value. 
  Is it possible to load this data directly to Table? If not do you have any idea how I can download this data to SQL table?</p>
  
  <p>Below my sql code</p>
  
  <pre><code>DECLARE
  @xmlObject INT,
  @vResponseText VARCHAR(MAX),
  @vStatus INT,
  @vStatusText VARCHAR(200)
  EXEC sp_OACreate 'MSXML2.ServerXMLHTTP', @xmlObject OUTPUT
  EXEC sp_OAMethod @xmlObject, 'open', NULL, 'GET',                                             'https://www.wunderground.com/history/airport/EPWA/2016/1/1/CustomHistory.html?dayend=31&amp;monthend=12&amp;yearend=2016&amp;req_city=&amp;req_state=&amp;req_statename=&amp;reqdb.zip=&amp;reqdb.magic=&amp;reqdb.wmo=&amp;format=1'
  EXEC sp_OAMethod @xmlObject, 'send'
  EXEC sp_OAMethod @xmlObject, 'responseText', @vResponseText OUTPUT
  EXEC sp_OAMethod @xmlObject, 'Status', @vStatus OUTPUT
  EXEC sp_OAMethod @xmlObject, 'StatusText', @vStatusText OUTPUT
  EXEC sp_OADestroy @xmlObject
  SELECT @vResponseText
  </code></pre>
  
  <p>If I change second EXEC line command returns value in one rows: SQL code below:</p>
  
  <pre><code>DECLARE
  @xmlObject INT,
  @vResponseText VARCHAR(MAX),
  @vStatus INT,
  @vStatusText VARCHAR(200)
  EXEC sp_OACreate 'MSXML2.ServerXMLHTTP', @xmlObject OUTPUT
  EXEC sp_OAMethod @xmlObject, 'open', NULL, 'GET',  'https://www.wunderground.com/history/airport/EPWA/2016/1/1/CustomHistory.html?dayend=31&amp;monthend=12&amp;yearend=2016&amp;req_city=&amp;req_state=&amp;req_statename=&amp;reqdb.zip=&amp;reqdb.magic=&amp;reqdb.wmo=&amp;format=1'
  EXEC sp_OAMethod @xmlObject, 'send'
  EXEC sp_OAMethod @xmlObject, 'responseText', --@vResponseText OUTPUT
  EXEC sp_OAMethod @xmlObject, 'Status', @vStatus OUTPUT
  EXEC sp_OAMethod @xmlObject, 'StatusText', @vStatusText OUTPUT
  EXEC sp_OADestroy @xmlObject
  SELECT @vResponseText
  </code></pre>
  
  <p>Thanks in advance!
  Cezary</p>