{tocify} $title={Table of Contents}
And inserted few rows in it
Introduction
It is very common scenario in integration space, where we have to connect to the database for some CRUD operations.
So we have two options either write a query for each operation or create a stored procedure and call it.
Both will serve the purpose, but which is better?
Stored procedures have advantage over queries, like
- Firstly it is pre-compiled (Query compiles every time it execute)
- It is reusable
- It is faster
- More secure
- Reduction in Network Traffic (as it executes at server side)
- Any change in stored procedure code does not affect clients, clients automatically get the new version of it
All right, let's build the solution
Create a Stored Procedure
For this demo, I created a simple Table
CREATE TABLE products (
product_name nvarchar(50),
price int
)
INSERT INTO products (product_name, price)
VALUES
('Desktop Computer',800),
('Laptop',1200),
('Tablet',200),
('Monitor',350),
('Printer',150)
And a simple Stored Procedure which simply returns Product name and
Price from above table
CREATE PROCEDURE GetProducts
AS
BEGIN
SET NOCOUNT ON
SELECT P.product_name,P.price FROM
products P
END
Create a Logic App to connect to SQL and execute Stored procedure
Create a logic app with Recurrence trigger and then add another step and search for SQL and select SQL Server
Testing
Run the logic app, by forcing the trigger (manual Run) or set the recurrence as per convenience . (I set recurrence at 3 min)
Errors Occurred during above implementation
- Logic App not allowed to access the SQL server | Cannot open server 'xx' requested by the login. Client with IP address 'xx' is not allowed to access the server
- The server was not found or was not accessible
- Cannot open server 'xx' requested by the login. Client with IP address 'xx' is not allowed to access the server.
If you have questions or suggestions, feel free to do in comments section below !!!
Do share if you find this helpful .......
Knowledge Sharing is Caring !!!!!!
Learn More about Logic App
- BizTalk Developer getting started with Logic App
- Getting Started with Logic Apps - Fundamentals
- Getting Started with Logic Apps - Enterprise Application Integration
- Getting Started with Logic Apps - AS2
- Getting Started with Logic Apps - EDI X12 Fundamentals
- Getting Started with Logic Apps - XML to EDI X12
- Getting Started with Logic Apps - EDI X12 to XML
- Getting Started with Logic Apps - What happened to the Request?
- Inserting Multiple Records In On Prem SQL Using Logic App
- Inserting data in On Premises SQL Database using Logic Apps
- Installing and Configuring On Premises Data Gateway - By adding user to Active Directory
- XML Batching(Aggregation) in Logic App
- Batching(Aggregating) messages in Logic App
- Debatching(Splitting) JSON Message in Logic Apps - ForEach and SplitOn
- Debatching(Splitting) XML Message in Logic Apps - ForEach and SplitOn
- Securing Logic App with Azure Active Directory authentication
- Removing ns0: prefix from xml output from BizTalk/Logic app XSLT map
- Using Managed Identity in Logic Apps for Calling Active Directory Secured Function App
- Logic Apps : Fetching ISA and GS Segment Values From Interchange Envelope and Mapping
- Logic Apps : For Each Inside a For Each - Fetching values from field in an array inside an array
Tags:
Azure Logic Apps