一般分为十种情况,每种语法各不相同:
1、 创建语法
1
2
3
4
5
6
7
create proc | procedure pro_name
[{@参数数据类型} [=默认值] [output],
{@参数数据类型} [=默认值] [output],
....
]
as
SQL_statements
2、 创建不带参数存储过程
1
2
3
4
5
6
7
8
9
10
--创建存储过程
if (exists (select * from sys.objects where name = 'proc_get_student'))
drop proc proc_get_student
go
create proc proc_get_student
as
select * from student;
--调用、执行存储过程
exec proc_get_student;
3、 修改存储过程