【问题标题】:Inner-join errors on SQL stored procedureSQL 存储过程的内部连接错误
【发布时间】:2021-11-10 23:46:43
【问题描述】:

我想我只是有点疲倦,但我现在还没有答案。会报错

SQL 错误 [4145] [S0001]:在“WHERE”附近预期条件的上下文中指定的非布尔类型的表达式

代码:

ALTER PROCEDURE [dbo].[spDirectoryLookup]
    (@LookupName nvarchar(100), 
     @ClientNumber bigint)
AS
BEGIN
    SELECT DISTINCT 
        DL.subid,
        C.ClientNumber,
        C.ClientName,
        listid,
        dld.Description  
    FROM 
        INTELLIGENT_2414_1.DBO.dirListings DL 
    INNER JOIN 
        Intelligent_2414_1.DBO.cltClients C ON DL.subid = C.subid
    INNER JOIN 
        INTELLIGENT_2414_1.DBO.dirListingDescriptions dld ON dld.listID 

    WHERE 
        Description LIKE '%'+@LookupName+'%'
        AND DL.subid IN (SELECT subid 
                         FROM Intelligent_2414_1.DBO.cltClients C 
                         WHERE C.ClientNumber = @ClientNumber)
END

【问题讨论】:

标签: sql select syntax-error inner-join


【解决方案1】:

第二个joinon 子句缺少一个条件。我猜你打算这样做:

INNER JOIN INTELLIGENT_2414_1.DBO.dirListingDescriptions dld on dld.listID = DL.listid

【讨论】:

  • 非常感谢! Mureinik,我想我需要在我的眼睛完全流血之前停止编码:)我真的很感激!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-06-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-06-21
  • 1970-01-01
相关资源
最近更新 更多