日期:2014-05-18 浏览次数:20692 次
Create PROCEDURE PRO_SERCH @postTitle varchar(100), @resoutceTitle varchar(100) as Declare @Str_SQL nvarchar(MAX), @Choese varchar(10); BEGIN if (@Choese='帖子') set @Str_SQL='select * from tb_Post where postTitle like ''%@postTitle %'' ' if (@Choese='资源') set @Str_SQL='select * from tb_Resource where resoutceTitle like ''%@resoutceTitle %'' ' exec(@Str_SQL) END
Create PROCEDURE PRO_SERCH @postTitle varchar(100), @resoutceTitle varchar(100) as Declare @Str_SQL nvarchar(MAX) BEGIN if @postTitle is not null set @Str_SQL='select * from tb_Post where postTitle like ''%'+@postTitle +'%''' if @resoutceTitle is not null set @Str_SQL='select * from tb_Resource where resoutceTitle like ''%'+@resoutceTitle +'%''' exec(@Str_SQL) END