skip to Main Content

I now how to create the procedure but do not know how to call the procedure

this is what I have done. Created the procedure :

CREATE PROCEDURE SelectAllCustomers
AS
SELECT * FROM Customers
GO;

I have created it but next thing how to call the procedure, directly in the SQL console?

2

Answers


  1. you can call it like this:

    exec <procedure_name>
    

    in your case:

    exec SelectAllCustomers
    

    if you want to pass parameters, just put it after the procedure name using the comma as a separator:

    exec SelectAllCustomers 'parameter_1', 'parameter_2'
    
    Login or Signup to reply.
  2. You can call it using CALL. e.g.

    CALL SelectAllCustomers();
    

    See docs for details.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search