CREATE PROCEDURE USP_SEARCH_HOTELS
(
@Text varchar(50),
@Type varchar(40)
)
AS
BEGIN
Declare @Query VARCHAR(60)
IF @Type = 'By Country'
BEGIN
SET @Query = 'Hotel.countryName like '+ @Text+'%'
END
ELSE IF @Type = 'By State'
BEGIN
SET @Query = 'HOTEL.stateName like '+ @Text+'%'
END
ELSE IF @Type='By Property Name'
BEGIN
SET @Query='hotel.propertyname like'+ @Text+'%'
End
ELSE IF @Type='By Rating'
BEGIN
SET @Query='hotel.starRating='+ Cast(@Text as INT)
END
ELSE IF @Type='By City'
BEGIN
SET @Query='hotel.cityName like '+ @Text+'%'
END
begin
select * from hotel,tbl_cust_info
where
hotel.agentID=Tbl_Cust_Info.Cust_ID
and
(@Query)
end
END
WHAT IS THE ERROR IN THIS PROCEDURE PLEASE HELP.