2024年5月28日发(作者:)

View Code

3、全部类型存储

USE [cishu]

GO

/****** Object: StoredProcedure [dbo].[MessageReault_SearchFullTextListByAll] Script Date: 03/09/2018 17:43:54 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

ALTER PROCEDURE [dbo].[MessageReault_SearchFullTextListByAll]

@searchContent NVARCHAR(100) = NULL,

@TypeValue NVARCHAR(100) = NULL,

@PageIndex INT=1,

@PageSize INT=10

--@AllCount INT=0 OUTPUT

AS

BEGIN

SET NOCOUNT ON;

DECLARE @minIndex INT

DECLARE @maxIndex INT

DECLARE @ExecSql NVARCHAR(200)

SELECT @minIndex=MIN(yIndex),@maxIndex=MAX(yIndex) FROM Config a

WHERE TypeValue!='All'

WHILE @minIndex<=@maxIndex

BEGIN

DECLARE @tempAllCount INT

DECLARE @tempTypeValue NVARCHAR(100)

SET @tempAllCount=0

SELECT TOP 1 @ExecSql=sqlString1,@tempTypeValue=TypeValue FROM [SearchConfig] WHERE TypeValue!='All' AND DisplayIndex=@minIndex

IF (@ExecSql IS NULL OR @ExecSql='')

BEGIN SET @minIndex=@minIndex+1 CONTINUE END

ELSE

BEGIN

CREATE TABLE #tmp(

AllCount NVARCHAR(100),

TypeValue NVARCHAR(100)

)

INSERT INTO #tmp

exec sp_executesql @ExecSql,N'@searchContent nvarchar(100),@TypeValue nvarchar(100),@AllCount INT OUTPUT',

@searchContent=@searchContent,@TypeValue=@tempTypeValue,@AllCount=@tempAllCount OUTPUT

DROP TABLE #tmp

END

IF @tempAllCount>0

BEGIN

SET @minIndex=@minIndex+1

EXEC MessageReault_SearchFullTextList @searchContent,@tempTypeValue,@PageIndex,@PageSize

BREAK

END

ELSE

BEGIN

SET @minIndex=@minIndex+1

CONTINUE

END

END

--exec(@ExecSql)

SET NOCOUNT OFF;

END

GO

View Code