无法在char上调用方法

时间:2013-11-21 21:33:30

标签: sql sql-server-2008 sql-server-2005

此错误似乎来自以下代码块。这个错误的可能原因是什么?

  

无法在char上调用方法

INSERT INTO #ActiveTerminals
SELECT DISTINCT a.TerminalId, SerialNumber, a.[LoadTime] [LastSale] 
FROM Terminal INNER JOIN
(
    SELECT DISTINCT Ticket.TerminalId,max(LoadTime) [LoadTime] FROM 
    Ticket with (NOLOCK)
    JOIN ProductDenomination with (NOLOCK) ON (ProductDenomination.DenominationId = Ticket.DenominationId)
    WHERE ProductDenomination.ProductId NOT IN (SELECT * FROM dbo.fn_MVParam(@sExcludedProducts)) AND
     datediff(day,LoadTime,@dteActiveSalesEndDate) <= @iLastSoldWithinDays
    GROUP BY TerminalId

    UNION ALL

    SELECT DISTINCT VarTicket.TerminalId, max(TransactionDate) [LoadTime]  FROM 
    VarTicket with (NOLOCK) 
    WHERE VarTicket.ProductId NOT IN (SELECT * FROM dbo.fn_MVParam(@sExcludedProducts)) AND
     VarTicket.TerminalId NOT IN (SELECT TerminalId FROM #ActiveTerminals)
    AND datediff(day,TransactionDate,@dteActiveSalesEndDate) <= @iLastSoldWithinDays
    GROUP BY TerminalId
)a ON (Terminal.TerminalId = a.TerminalId.TerminalId) 
ORDER BY a.TerminalId, SerialNumber

1 个答案:

答案 0 :(得分:10)

对于这一行:

)a ON (Terminal.TerminalId = a.TerminalId.TerminalId) 

将其更改为:

)a ON (Terminal.TerminalId = a.TerminalId)