Just wondering if its possible to call a URL from a stored procedure (eventually adding that procedure to a sql job) As the webpage refreshes my database, it would be excellent if I could automate this process.
Edit:
I want to be able to request a webpage from a store procedure. On the page load of the desired webpage there is a function that refreshes my database. I want it to refresh my database at 4 am every day. In order for me not to manually go onto the site at 4am (still sleeping) I need something else to do it for me. I thought sql jobs would be excellent, as I can set the time, and the job up. I don't know PowerShell all that well, and wanted to know if I could request a URL, or visit a url using a stored procedure or any other way.
@newurl is url you want to hit @response is response you received
EXEC Sp_oacreate 'MSXML2.XMLHTTP',@obj OUT;
EXEC Sp_oamethod @obj,'open',NULL,'get',@newurl,'false'
EXEC Sp_oamethod @obj,'send'
EXEC Sp_oamethod @obj,'responseText',@response OUTPUT
EXEC Sp_oadestroy @obj
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With