基本新增、修改、刪除的儲存過程
=========新增==========
alter procedure [guestroomadd]
(@rid [varchar](50),
@rtype [int],
@rposition [varchar](50),
@rdescribe [varchar](50))
as insert into [hms].[dbo].[guestroom]
( [rid],
[rtype],
[rposition],
[rdescribe])
values
( @rid,
@rtype,
@rposition,
@rdescribe)
=========修改==========
alter procedure [guestroommodify]
(@rid [varchar](50),
@rtype [int],
@rposition [varchar](50),
@rdescribe [varchar](50))
as update [hms].[dbo].[guestroom]
set [rtype] = @rtype,
[rposition] = @rposition,
[rdescribe] = @rdescribe
where
( [rid] = @rid)
=========刪除===========
alter procedure [guestroomdelete]
(@rid [varchar](50))
as delete [hms].[dbo].[guestroom]
where
( [rid] = @rid)
=======檢視詳細資訊=========
alter procedure [guestroomdetail]
@rid varchar(50)
as select [dbo].[roomtype].[tid],
[dbo].[roomtype].[tname],
[dbo].[roomtype].[tprice],
[dbo].[guestroom].[rid],
[dbo].[guestroom].[rtype],
[dbo].[guestroom].[rposition],
[dbo].[guestroom].[rdescribe]
from [dbo].[roomtype],
[dbo].[guestroom]
where guestroom.rtype=roomtype.tid
and guestroom.rid=@rid
========顯示列表=============
alter procedure [guestroomlist]
as select [dbo].[roomtype].[tid],
[dbo].[roomtype].[tname],
[dbo].[roomtype].[tprice],
[dbo].[guestroom].[rid],
[dbo].[guestroom].[rtype],
[dbo].[guestroom].[rposition],
[dbo].[guestroom].[rdescribe]
from [dbo].[roomtype],
[dbo].[guestroom]
where guestroom.rtype=roomtype.tid
order by tid desc
mysql儲存過程應用 MySQL儲存過程使用解析
mysql儲存過程 儲存過程 stored procedure 是一種在資料庫中儲存複雜程式,以便外部程式呼叫的一種資料庫物件。目的是為了完成特定功能的sql語句集,經編譯建立並儲存在資料庫中,使用者可通過指定儲存過程的名字並給定引數 需要時 來呼叫執行。說白了就是資料庫 sql語言層面的 封裝與重...
儲存過程的應用
今天深入講了儲存過程和如何建立儲存過程 宣告新的結束符 delimiter 一 建立儲存過程 create procedure p1 select from t1 單條 create procedure p1 begin 流程控制結構 sql語句集合 end 二 引數的應用 1 in 輸入形參引數,...
MSSQL儲存過程應用
1.原始表inoutinfo 2.現在想輸入時間範圍和操作型別輸出對應的結果 2.1建立儲存過程 create proc selecttype type nvarchar 10 starttime datetime,endtime datetime asselect opdt,opemp,optyp...