62,266
社区成员
发帖
与我相关
我的任务
分享
/*查询所有的开房信息(首页的Grid,带搜索功能)*/
create proc GetOpenRoomInfoAll(@message varchar(50))
as
if (@message = '')
begin
select a.OpenRoomId,b.Number,c.TypeName,c.TypePrice,a.OpenTime,a.PlanDays,a.GuestMoney,a.GuestId,
a.GuestName,a.GuestPhone,a.Remark from OpenRoomInfo as a,Room as b,RoomType as c
where a.RoomId = b.RoomId and b.TypeId = c.TypeId
end
else
begin
select a.OpenRoomId,b.Number,c.TypeName,c.TypePrice,a.OpenTime,a.GuestMoney,a.GuestId,a.GuestName,
a.GuestPhone,a.Remark from OpenRoomInfo as a,Room as b,RoomType as c where a.RoomId = b.RoomId and
b.TypeId = c.TypeId and (b.Number like @message+'%' or c.TypeName like @message+'%'
or a.GuestId like @message+'%' or a.GuestName like @message+'%'
or a.GuestPhone like @message+'%' or a.Remark like @message+'%')
end
go
go可不是sql语句,根本不能发送给sql server去执行。go这种东西。当你在sql server的查询分析器中打入go,那不过是让查询分析器分割sql语句用的,查询分析器也不会把这个“go”发送给sql server系统去执行的。