rectify Error in my Storred procedure
I am getti开发者_StackOverflow社区ng error near AS what is a problem in 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
)
I am getting error near AS what is a problem in IF..?
parentheses in wrong place:
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
What are you planing to return if @RD_AND != 1
You need to remove the brackets... after your stored proc. name...
Change it to something like:
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
精彩评论