How to write a REST API that will get or put onto a SQL server database

MrFlinstone 686 Reputation points
2021-09-16T14:05:34.88+00:00

Hi All.

I am looking to create an api such that a record can be written into a SQL server database. It will simply call a stored procedure with some data received. The api will return a status code to confirm if the insert has been successful or not.

The environment is on-premise (my laptop) and as such cannot use Azure functionality.

Microsoft Partner Center API
Windows for business Windows Server User experience PowerShell
SQL Server Other
{count} votes

Accepted answer
  1. Seeya Xi-MSFT 16,586 Reputation points
    2021-09-17T05:54:07.337+00:00

    Hi @MrFlinstone ,

    Please refer to this: https://www.zealousweb.com/calling-rest-api-from-sql-server-stored-procedure/
    AND https://hevodata.com/learn/sql-server-rest-api-integration/
    Hope these articles are helpful to you.

    Best regards,
    Seeya


    If the response is helpful, please click "Accept Answer" and upvote it, as this could help other community members looking for similar queries.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Limitless Technology 39,916 Reputation points
    2021-09-17T09:22:24.187+00:00

    Hello MrFlinstone,

    Runs a script containing statements supported by the SQL Server SQLCMD utility.

    The Invoke-Sqlcmd cmdlet runs a script containing the languages and commands supported by the SQL Server SQLCMD utility.

    The commands supported are Transact-SQL statements and the subset of the XQuery syntax that is supported by the database engine.

    This cmdlet also accepts many of the commands supported natively by SQLCMD, such as GO and QUIT.

    https://learn.microsoft.com/en-us/powershell/module/sqlserver/invoke-sqlcmd?view=sqlserver-ps

    Hope this answers all your queries, if not please do repost back.
    If an Answer is helpful, please click "Accept Answer" and upvote it : )

    Regards,

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.