CREATE PROCEDURE sp_search @minprice bigint=null, @maxprice bigint=null, @minarea int=null, @maxarea int=null, @location nvarchar(50)=null, @kind nvarchar(50)=null AS SELECT * FROM Landtbl WHERE ((@minprice is null and @maxpriceis null) or ([price] between @minprice and @maxprice)) and ((@minarea is null and @maxarea is null) or ([area] between @minarea and @maxarea)) and ((@location is null)or([location]=@location)) and ((@kind is null) or ([kind]=@kind))
You appear to have have an error in your WHERE statement. You have @maxpriceis null. It should read @maxprice is null.You have omitted the space between maxprice and is.
WHERE
@maxpriceis null
@maxprice is null
is
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)