The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Threaded View

Sql Server thinks nvarchar is money?

Hi

I have the followinf SPROC

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'