Hi
I have the followinf SPROC
NOTE: int_list_to_table & string_list_to_table are functions that parse a delimited list.Code:CREATE PROCEDURE SearchPropertyListByGroup2 ( @WhereClause nvarchar(2000) = '', @State varchar(500) = '', @OrderBy varchar(50) = '', @PriceMin money = 0, @Pricemax money = 99999999 ) AS SET NOCOUNT ON SELECT * FROM PropertyView WITH (NOLOCK) WHERE PropertyId IN ( SELECT PropertyId FROM PropertyAttributes WHERE AttributeId IN(SELECT number FROM int_list_to_table(@WhereClause)) ) AND State IN (SELECT txt FROM string_list_to_table(@State)) AND (LongPrice Between @PriceMin AND @PriceMax) ORDER BY CASE @OrderBy WHEN 'PropertyType' THEN PropertyType WHEN 'PropertyId' THEN Id WHEN 'PropertyPrice' THEN LongPrice WHEN 'Location' THEN LocationId ELSE Id END ASC GO
Now the line that is causing the error is WHEN 'PropertyType' THEN PropertyType, the error I get is
'Error 257: Implicit Conversion from datatype varchar to money is not allowed, use the CONVERT function to run this query'
The SPROC runs fine if I do not allow for the 'PropertyType' sort.
I am searching a VIEW, could this be the cause of the problem?
Thanks in advance!![]()







)

Bookmarks