STORED PROCEDURES

TARGIT InMemory supports stored procedures. Stored procedures are created with the CREATE PROCEDURE Command and dropped with DROP PROCEDURE. They are executed using the EXEC or EXECUTE commands. RETURN is used to return from a Stored Procedure.

Stored Procedures accept parameters.

Example 1 - Declaring a SP with 1 parameter and using EXEC:

CREATE PROCEDURE myProc @param1 integer as 
BEGIN
SELECT * FROM ORDERS
where orderid in (@param1 )
END

EXEC myProc 10248

Or

EXEC myProc @param1=10248

Example 2 - Setting a default value to a parameter:

CREATE PROCEDURE myProc3 @param1 integer = 10250 as 
BEGIN
SELECT * FROM ORDERS
where orderid in (@param1 )
END

EXEC myProc3
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.