------------------ 系统存储过程 -------------------
--微软定义好的,能够直接使用的存储过程,叫作系统存储过程
--system procedure 如:sp_xxx
exec sp_helpdb master 程序员
exec sp_bindrule学习
----------------- 自定义存储过程 -------------------
--由程序员定义的存储过程spa
--扩展存储过程ast
----================== 存储过程的建立 无参数 ===============---
--定义
create procedure pro
as
begin
declare @x int
set @x=1
while @x<10
begin
print @x
set @x=@x+1
end
end扩展
--调用
exec proselect
--删除存储过程
drop procedure pro2程序
--修改
alter procedure pro
as
begin
declare @x int
set @x=1
while @x<10
begin
print @x
set @x=@x+1
end
end查询
-------============ 存储过程的建立 有参数 ===============------------ 存储过程
--定义有参数 存储过程,实现查询出学生的成绩,按学生姓名模糊查询。以姓名关键字为参数 【重点】
create procedure por_select @sname varchar(20)
as
begin
select * from student where name like '%'+@sname+'%'
enddb
exec por_select '三'
--查询存储过程
exec sp_help por_select
exec sp_helptext por_select
做者还在学习中,发现错误的请在评论区留言。 若是有客友以为文章还行的话,请点波推荐哦👍。 谢谢大家!!