现在的位置: 首页 > 综合 > 正文

存储过程 写法

2013年02月16日 ⁄ 综合 ⁄ 共 475字 ⁄ 字号 评论关闭
 strSQL = "exec daycount " + Session("grade") + ",'" + Session("police") + "','" + AToDay + "'"

CREATE Procedure daycount
@Grad int,
@police Varchar(10),
@currenttime varchar(20)

as
if @Grad=0
begin
select (select hotelname from info_hotel where info_hotel.hotelcode=Info_Guest.hotelcode) as hotelname,Count(guestcode) as UpDataNum from info_Guest where substring(LoginTime,1,8)=@currenttime and hotelcode in (select PH.hotelcode from Info_hotel as PH where PH.ting=@police and hotelstatus = 1) group by HotelCode  ORDER BY UpDataNum
end
  
GO

抱歉!评论已关闭.