Archived Forum Post

Index of archived forum posts

Question:

How to HTTP GET (MS SQL Server) Binary Data

May 04 '17 at 19:41

How to you get the PDF (binary) from the request below.

https://environment.extranet.gov.ab.ca/apps/GIC/Report/ViewReport.aspx?wellreportid=12014857


Answer

You can use the Download method of the ChilkatHttp object to download and save the PDF to your computer.


Answer

This method downloads the file to the file system, I would like to download the PDF to a VARBINARY(MAX). Is this approach an option?


Answer

For binary, you can use downloaddb in ChilkatHttp to fill a BinData object. Then you can get the binary from the BinData and add it to your SQL server.


Answer

Thanks for the suggestion, might you have a code example (sql) as I am not getting anywhere productive myself.

Thanks.


Answer

I am attempting to write in tSQL.


Answer

Call http.QuickGet(the_url_for_your_PDF), which returns a Variant containing the binary bytes of the resource at the passed-in URL.

The next step is to figure out how to insert a Variant into a varbinary(max). I Googled "insert variant into varbinary max" and found many results, but this is the 1st:

http://stackoverflow.com/questions/2214628/insert-bytes-array-into-varbinarymax-record


Answer

Thanks for your help, just not getting anywhere with this method. I have written an SQLCLR to accomplish this task.

Lots of interesting options here.