Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004
    Posts
    24

    Angry Unanswered: Implicit Conversion in Query Analyzer

    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?

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    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
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Jun 2004
    Posts
    24
    Woo hoo! Thanks -- I forgot to try that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •