Stored Procedure Stored Procedures Parameterized Stored Procedures Parameter



















- Slides: 19
ම ඩයල වශල ෂණය • Stored Procedure හඳනව • Stored Procedures ක රය වට ද ම. න ව ම. • Parameterized Stored Procedures ක රය වට න වම • Parameter Sniffing. • Function හඳනව දම. • Scalar Functions ක රය වට න වම • Table-Valued Functions ක රය වට . න වම . .
Stored Procedure හඳනව ද ම. • Stored Procedures සත වය හ ක ද වල , – input parameters – output parameters
Stored Procedures ක රය වට • CREATE PROCEDURE Sales. Get. Salesperson. Names AS BEGIN SELECT sp. Sales. Personl. D, c. Last. Name, c. First. Name FROM Sales. salesperson AS sp INNER JOIN Person. Contact AS C ON sp. Sales. Person. ID = c. Contact. ID WHERE sp. Territory. ID IS NOT NULL ORDER BY sp. Sales. Person. ID END; න වම .
Stored Procedures Execute කර ම….
Stored Procedure ම රගස චක…. .
ENCRYPTION සමඟ CREATE PROCEDURE Human. Resources. Employee. List WITH ENCRYPTION AS SELECT Employee. ID. Last. Name, First. Name FROM Human. Resources. Employee;
Microsoft Virtual Academy DEMO Stored Procedures
Input Parameters භ වත කර ම. CREATE PROCEDURE Sales. Orders. Date. Status @Due. Date datetime, @Status tinyint = 5 AS SELECT Sales. Order. ID, Order. Date, Customer. ID FROM Sales. Order. Header AS soh WHERE soh. Due. Date = @Due. Date AND soh. [Status] = @Status; GO
Output Parameters භ වත කරම . CREATE PROC sales Get. Order. Count. By. Due. Date @Due. Date datetime, @order. Count int OUTPUT AS SELECT (Order. Count = C 0 UNT(1) FROM Sales. Order. Header AS soh WHERE soh. Due. Date =@Due. Date; GO DECLARE @Due. Date datetime '20050713'; DECLARE @ordercount int; EXEC sales. Get. Order. Count. By. Due. Date @Due. Date, @order. Count OUTPUT; SELECT @Order. Count;
Microsoft Virtual Academy DEMO Parameters pass කරම
Parameter Sniffing…. .
Microsoft Virtual Academy DEMO Parameter Sniffing
Scalar Functions ක රය වට න වම. CREATE FUNCTION dbo. Extract. Protocol. From. URL ( @URL nvarchar(1000)) RETURNS nvarchar(1000) AS BEGIN RETURN CASE WHEN CHARINDEX(N': ', @URL, 1) >= 1 THEN SUBSTRING(@URL, 1, CHARINDEX(N': ', @URL, 1) - 1) END; SELECT dbo. Extract. Protocol. From. URL(N'http: //www. microsoft. com'); IF (dbo. Extract. Protocol. From. URL(@URL) = N'http'). . .
Microsoft Virtual Academy DEMO Scalar Function
Table-Valued Functions ක රය වට න වම.
Microsoft Virtual Academy DEMO Table-Valued Function
Stored Procedures සහ Functions භ වත කරම සමපණඩනය • Stored Procedure හඳනව • Stored Procedures ක රය වට දම. . න වම • Parameterized Stored Procedures ක රය වට න වම • Parameter Sniffing. • Function හඳනව දම. • Scalar Functions ක රය වට න වම • Table-Valued Functions ක රය වට . න වම . .