我在AS附近遇到错误在IF中出现了什么问题..?
Create Procedure dbo.sp_Normal_Search
(
@title as nvarchar(max),
@Description as nvarchar(max),
@Keywords as nvarchar(max),
@Chk_title as Bit,
@Chk_Description as Bit,
@Chk_Keywords as Bit,
@RD_AND as Bit,
@RD_OR as Bit
AS
if(@RD_AND = 1)
Begin
if(@Chk_title = 1)
Begin
(Select title from server_des where title Like '%'+ @title+'%')
End
END
GO
)
我在AS附近遇到错误在IF中出现了什么问题..?
答案 0 :(得分:3)
括号在错误的地方:
Create Procedure dbo.sp_Normal_Search
(
@title as nvarchar(max),
@Description as nvarchar(max),
@Keywords as nvarchar(max),
@Chk_title as Bit,
@Chk_Description as Bit,
@Chk_Keywords as Bit,
@RD_AND as Bit,
@RD_OR as Bit
)
AS
if @RD_AND = 1
Begin
if @Chk_title = 1
Begin
Select title from server_des where title Like '%'+ @title+'%'
End
END
GO
如果@RD_AND!= 1
,您打算返回什么?答案 1 :(得分:1)
您需要在存储过程后删除括号....名称...
将其更改为:
Create Procedure dbo.sp_Normal_Search
@title as nvarchar(max),
@Description as nvarchar(max),
@Keywords as nvarchar(max),
@Chk_title as Bit,
@Chk_Description as Bit,
@Chk_Keywords as Bit,
@RD_AND as Bit,
@RD_OR as Bit
AS
if @RD_AND = 1
Begin
if @Chk_title = 1
Begin
Select title
from server_des
where title Like '%' + @title + '%'
End
END
GO