存储过程基本使用

1.基础语法

create proc | procedure pro_name
    [{@参数数据类型} [=默认值] [output],
     {@参数数据类型} [=默认值] [output],
     ....
    ]
as
  SQL_statements
GO

2.创建不带参数存储过程

if (exists (select * from sys.objects where name = 'proc_test'))
    drop proc proc_getProjectSalaryByMonth
go
create proc proc_test
as 
	select * from Companies
go 

exec proc_test

 3、 修改存储过程

alter proc proc_test
as
select * from test2;
go 
exec proc_test

4、 带参存储过程