1.預存程序的分類
系統預存程序
#本機預存程序(使用者自訂)
#暫存程序(局部【#】、全域【##】暫存程序)
#2.建立預存程序
--选出价格区间的商品信息create procedure sp_goods_price@minprice float ,@maxprice floatas select * from goods where price>=@minprice and price <=@maxpricego
執行預存程序:execute sp_goods_price 200 2000
3.修改預存程序
##
create procedure sp_goods_betw@minprice float =200,@maxprice float=3000as select * from goods where price>=@minprice and price <=@maxpricego4.刪除預存程序
drop procedure sp_goods_price5.查看預存程序
#
sp_helptext procedureName sp_help procedureName6.重新命名預存程序
#
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 <=@maxpricego<br/></p>**全域預存程序
create procedure ##sp_goods_betw@minprice float ,@maxprice floatas select * from goods where price>=@minprice and price <=@maxpricego**不加快取的預存程序
,
with recompile
as select * from goods where price>=@minprice and price <=@maxpricego**加密預存程序
,
with enctyption
as select * from goods where price>=@minprice and price <=@maxpricego
以上是預存程序的定義、修改和刪除的操作方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!