0

这是我的存储过程。当我在@BusinessName 中传递“,”时,出现错误:全文搜索条件“,”中“,”附近的语法错误。如何解决此错误?

ALTER PROCEDURE [dbo].[SearchBusiness] 
@uid bigint,
@BusinessName nvarchar(100),
@GroupId int=0
AS
BEGIN

IF ISNULL(@BusinessName,'') = '' SET @BusinessName = '""' ;

        select          
        ru.FirstName+ ' '+ru.LastName AS DisplayName,           
        ru.BusinessName
        from UserConnection uc join registereduser ru on 
        (uc.FromUserId=@uid and uc.ToUserId=ru.UserId)  
        where           
        @BusinessName = '""' OR
        contains(ru.BusinessName, @BusinessName
        ) 
END
4

1 回答 1

0

试试这个。

它可以帮助你

ALTER PROCEDURE [dbo].[SearchBusiness] 
@uid bigint,
@BusinessName nvarchar(100),
@GroupId int=0
AS
BEGIN

IF ISNULL(@BusinessName,'') = '' SET @BusinessName = '""' ;

    select          
    ru.FirstName+ ' '+ru.LastName AS DisplayName,           
    ru.BusinessName
    from UserConnection uc join registereduser ru on 
    (uc.FromUserId=@uid and uc.ToUserId=ru.UserId)  
    where           
    @BusinessName = '""' OR ru.BusinessName Like '%' + lTrim(rTrim(@BusinessName)) + '%'

END
于 2019-07-11T12:13:27.143 回答