I am trying to construct a query in Query Analyzer (with SQL Server 2000), but am getting an error regarding "implicit conversion."
Here is the query:
SELECT dbo.AUCTION.EbayNum, dbo.AUCTION.EndDate,
DATENAME([month], dbo.AUCTION.EndDate) + ' ' + DATENAME([year], dbo.AUCTION.EndDate) AS [PmtMonth],
dbo.LOT.Description, dbo.AUCTION.WinBid,
PaidStat = CASE dbo.AUCTION.PaidStatus
WHEN 0 THEN ''
ELSE 'PAID'
END,
PaidAmt = CASE dbo.AUCTION.PaidStatus
WHEN 0 THEN ''
ELSE dbo.AUCTION.WinBid
END
FROM dbo.AUCTION INNER JOIN
dbo.LOT ON dbo.AUCTION.LotNum = dbo.LOT.LotNum
WHERE (LEN(dbo.AUCTION.Winner) > 0)
The error occurs in the PaidAmt CASE statment:
"Implicit conversion from data type varchar to money is not allowed. Use the CONVERT function to run this query."
Why is there an implicit conversion going on? And how can I fix it? :mad:Maybe here:?
PaidAmt = CASE dbo.AUCTION.PaidStatus
WHEN 0 THEN ''
You are trying to insert a zero-length string into the PaidAmt column (presumably money datatype).
Try this instead:
PaidAmt = CASE dbo.AUCTION.PaidStatus
WHEN 0 THEN NULL|||Woo hoo! Thanks -- I forgot to try that. :)
No comments:
Post a Comment