1.存储过程的分类
-
系统存储过程
-
本地存储过程(用户自定义)
-
临时存储过程(局部【#】、全局【##】临时存储过程)
2.创建存储过程
--选出价格区间的商品信息create procedure sp_goods_price@minprice float ,@maxprice floatas select * from goods where price>=@minprice and price <p>执行存储过程: execute sp_goods_price 200 2000</p><p>3.修改存储过程</p><p class="cnblogs_code"><br></p><pre class="brush:sql;toolbar:false;">create procedure sp_goods_betw@minprice float =200,@maxprice float=3000as select * from goods where price>=@minprice and price <p>4.删除存储过程</p><p class="cnblogs_code"><br></p><pre class="brush:sql;toolbar:false;">drop procedure sp_goods_price
5.查看存储过程
sp_helptext procedureName sp_help procedureName
6.重命名存储过程
exec sp_rename oldName newName
**局部存储过程
<p style="margin-bottom: 7px;">create procedure #sp_goods_betw@minprice float ,@maxprice floatas select * from goods <br>where price>=@minprice and price </p>
**全局存储过程
create procedure ##sp_goods_betw@minprice float ,@maxprice floatas select * from goods where price>=@minprice and price <p>**不加缓存的存储过程</p><p class="cnblogs_code"><br></p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:sql;toolbar:false;"> ,
with recompile
as select * from goods where price>=@minprice and price <=@maxpricego
**加密存储过程
,
with enctyption
as select * from goods where price>=@minprice and price
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END