hello i am learning how to write stored procedures in sql server, i
would like to know what's wrong with the following statement? please
help
the management studio gives me the following error:
Msg 156, Level 15, State 1, Procedure spDealMasterSea rch, Line 19
Incorrect syntax near the keyword 'CASE'.
USE [mydatabase]
GO
/****** Object: StoredProcedure [dbo].[spHouseUpdate] Script Date:
04/15/2008 16:02:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFI ER ON
GO
CREATE PROCEDURE [dbo].[spDealMasterSea rch]
@in_Location varchar(50),
@in_HouseType varchar(50),
@in_Size varchar(50),
@in_ExpectedPri ce varchar(50)
AS
BEGIN
SELECT dealMasterId From
dealmaster INNER JOIN houses
ON dealmaster.Hous eId = houses.HouseId
WHERE
houses.Location = @in_Location AND
houses.HouseTyp e = @in_HouseType AND
houses.Size
CASE
WHEN @in_Size = 'within1000' THEN <= 1000
WHEN @in_Size = 'more1000' THEN 1000
ELSE 0
END AND
houses.expected Price
CASE
WHEN @in_ExpectedPri ce = 'within5m' THEN <= 5
WHEN @in_ExpectedPri ce = 'within10m' THEN <=10
WHEN @in_ExpectedPri ce = 'dontcare' THEN 0
ELSE 0
END AND
houses.EntitySt atus = 'A' AND
dealmaster.Enti tyStatus = 'A' AND
dealmaster.expe ctedPrice <= 5 AND
dealmaster.stat us = 'offering';
END