as select @temp=count(*) from roomlist where roomstatus=1 go declare @count int execute roomuse @count output select @count as '当前占用房间数' go
--2,空余房间数,roomstatus=0的房间表示空余. create proc roomisvoid @roomcount int output as select @roomcount=count(*) from roomlist where roomstatus=0 go declare @count int execute roomisvoid @count output select @count as '当前空余房间数' go
--3,空房间列表,roomstatus=0的房间表示空余. create proc roomvoidlist as select roomid as '空房间号码' from roomlist where roomstatus=0 order by roomid go exec roomvoidlist go
--4,空双人房列表,这里规定roomstatus=0时为空缺状态. create proc roomdoublevoid as select roomid,'空双人房' from roomlist where roomtypeid in( select roomtypeid from roomtypelist where roomtype='双人高级房' ) and roomstatus=0 order by roomid go exec roomdoublevoid go
--5,空单人房列表 create proc roomonevoid as select roomid,'空单人房' from roomlist where roomtypeid in( select roomtypeid from roomtypelist where roomtype='单人高级房' and roomstatus=0) order by roomid go exec roomonevoid go
--6,服务列表(procserverlist) --表名与 过程名不能相同 create proc procserverlist as select '服务名称'=servername,'服务价格'=servercost from serverlist order by serverid go exec procserverlist go --7,根据顾客名字查看他的详细信息(包括房间号) /*alter proc guestinfobyname @guestname char(10) as select * from guest where guestname=@guestname union select * from guestroom where guestid in (select guestid from guest where guest=@guestname) */ create proc guestinfobyname @guestname char(10) as select b.roomid ,a.* from guest a join guestroom b on a.guestid=b.guestid where a.guestname=@guestname go exec guestinfobyname '张生' go