Sql中存储过程的定义、修改和删除操作-宏鹏
Access软件网QQ交流学习群(群号码198465573),欢迎您的加入!
首页 >技术文章> ADP及SQL SERVER


Sql中存储过程的定义、修改和删除操作

发表时间:2017/10/18 8:20:19 评论(0) 浏览(6257)  评论 | 加入收藏 | 复制
   
摘 要:这篇文章主要介绍了Sql中存储过程的定义、修改和删除的相关资料,需要的朋友可以参考下
正 文:

1.存储过程的分类

  • 系统存储过程
  • 本地存储过程(用户自定义)
  • 临时存储过程(局部【#】、全局【##】临时存储过程)

2.创建存储过程


--选出价格区间的商品信息
create procedure sp_goods_price
@minprice float ,@maxprice float
as
select * from goods 
where price>=@minprice and price <=@maxprice
go
执行存储过程: execute sp_goods_price 200 2000


3.修改存储过程

create procedure sp_goods_betw
@minprice float =200,@maxprice float=3000
as
select * from goods 
where price>=@minprice and price <=@maxprice
go

4.删除存储过程


drop procedure sp_goods_price


5.查看存储过程


sp_helptext procedureName
sp_help procedureName


6.重命名存储过程


exec sp_rename oldName newName


**局部存储过程


create procedure #sp_goods_betw
@minprice float ,@maxprice float
as
select * from goods 
where price>=@minprice and price <=@maxprice
go


**全局存储过程


create procedure ##sp_goods_betw
@minprice float ,@maxprice float
as
select * from goods 
where price>=@minprice and price <=@maxprice
go


**不加缓存的存储过程


create procedure sp_goods_betw
@minprice float ,@maxprice float
with recompile
as
select * from goods 
where price>=@minprice and price <=@maxprice
go


**加密存储过程


create procedure sp_goods_betw
@minprice float ,@maxprice float
with enctyption
as
select * from goods 
where price>=@minprice and price <=@maxprice
go



Access软件网交流QQ群(群号:198465573)
 
 相关文章
快速开发平台--用Access命令按钮执行SQL存储过程的方法  【红尘如烟  2014/1/26】
微软未公开的SQLServer存储过程及有用的函数  【金宇  2015/6/2】
access调用MSSql存储过程通用代码  【丘山  2015/9/9】
SQL SERVER存储过程中如何使用事务与try catch  【学习也休闲  2016/12/7】
SQL server 存储过程语法大全  【易勋  2016/12/29】
常见问答
技术分类
相关资源
文章搜索
关于作者

宏鹏

文章分类

文章存档

友情链接