0

I'm studying SQL Server and so far I'm able to make API calls directly from SQL Server and with a stored procedure start a job to pull data periodically from an API. But when JSON responses are too long sometimes I can't solve it.

So, is there other way to automate an API call and then put that JSON response into a SQL Server table?

jarlh
  • 42,561
  • 8
  • 45
  • 63
  • 2
    Fundamentally you should never do that from within SQL Server - use some other external service. – Dale K Feb 02 '23 at 02:31
  • Ok, but what would be "another service"? Im not an expert. I have advanced knowledge of SQL server but basics of Java. So ...im stuck – Juan Pablo Humani Feb 02 '23 at 02:53
  • 1
    SQL Server is a data store, an engine for storing data. While you *can* write other code within it, its likely to cause performance issues, be hard to develop/debug/maintain and potentially other issues. A windows service, or console add run under a scheduled task is pretty simple to knock up and a much better way to do this. – Dale K Feb 02 '23 at 03:10
  • But now that I re-read your question and you say you already have some working code, well post your code and the issue you are having... somehow I suspect it might be similar to this question, just asked a few hours ago https://stackoverflow.com/questions/75317462/api-request-from-sql-server-unable-to-use-openjson – Dale K Feb 02 '23 at 03:12
  • If you're using the cloud, you could write an Azure Function and schedule it periodically. If you're on-premise, you could write a standalone console app and use the Windows scheduler to execute it periodically. – marc_s Feb 02 '23 at 04:53
  • Hi Dale, yeah that's true i understand SQL server is for data managing but im not able to programm a complex code in C# for example. That's why i was trying to do everything within SQL server. When you say "you could write a standalone app" what language or framework are you thinking of? Basically im trying to develop a simple app so you can follow and track prices and inventory quantity in MercadoLibre (sort of Amazon here in Argentina) – Juan Pablo Humani Feb 02 '23 at 12:30

0 Answers0