To execute a stored procedure from the query window, we can use
Executing parameter less stored procedure is very simple, use
EXEC with stored procedure name.
-- Execute parameter less Stored procedure EXEC GetAllPersonalDetails
Notice that the database dropdown must have the database selected in which the stored procedure exists.
Executing stored procedure with parameter is just passing the parameter value followed by the name of the stored procedure.
-- Execute Stored procedure with parameter EXEC LoadPersonalDetails 10
As this stored procedure, created above takes Age as parameter, we have passed its value as 10 that returns all records from the PersonalDetials table having age more than 10. If we have more than one parameter in the stored procedure, we pass those parameters values separated by comma.
Views: 3384 | Post Order: 88