create procedure grammar

Create procedure  pre_name
@variable list
as
pro_doby

Eg. Create procedure sp_GetUserInformation
    @userid char(15)=’00001’,
    @username char(2) output,  //which means username is outout
    @address char(40) outout,
    @email char(30)
   As
    Select userid,@username=username,@address=address,@email=email
    From t_userinfo
    Where userid=@userid
//statements: if the parameter has default value when creating procedure , then when we call the procedure, we can igonore the parameters which makes no error.
Eg. CREAT PROCEDURE SP_TEST
    USERID VARCHAR(10)=’982135’
       AS
SELECT * FROM T_USERNAME
WHERE USERID=@USERID;
GO
When we call the procedure, we can write this:
 àsp_test  (the default value of parameter userid is 982135,so we can ignore it)
 or   àsp_test ‘00001’

原文地址:https://www.cnblogs.com/Winston/p/1040957.html