Tuesday, 11 June 2024

Stored procedures

 Stored procedure is a prepared SQL code that you can save, so the code can be reused over and over again.

You can also pass parameters to a stored procedure, so that the stored procedure can act based on the parameter value(s) that is passed.


CREATE PROCEDURE SelectAllCustomers
AS
SELECT * FROM Customers
GO;

EXEC SelectAllCustomers;


CREATE PROCEDURE SelectAllCustomers @City nvarchar(30), @PostalCode nvarchar(10)
AS
SELECT * FROM Customers WHERE City = @City AND PostalCode = @PostalCode
GO;

EXEC SelectAllCustomers @City = 'London', @PostalCode = 'WA1 1DP';

No comments:

Post a Comment

Introduction to Dynamics 365 CE Data Migration using ADF

Dynamics 365 CE Data Migration using ADF can be necessary for various reasons, such as archiving historical data, integrating with other sys...