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 <=@maxpricego
drop procedure sp_goods_price
#
sp_helptext procedureName sp_help procedureName
#
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中文網其他相關文章!