我想将参数传递给存储过程但是有多个值并将其置于Where条件中作为IN(值)
我的SP:
ALTER PROCEDURE [dbo].[GetPoliciesPageWise]
(
@PageIndex INT = 1
,@PageSize INT = 10
,@RecordCount INT OUTPUT
)
AS
BEGIN
SET NOCOUNT ON;
SELECT ROW_NUMBER() OVER
(ORDER BY [ID] ASC)AS RowNumber
,[ID]
,[PolicyNumber]
,[FileName]
,[FileBarcode]
,[BoxBarcode]
,[CityID]
,[DocTypeID]
,[ProdcutType]
,[CategoryID]
,[TotalImages]
,[PIN]
,[PolicyHolder]
,[IDNo]
,[BranchID]
,[IntroducerID]
,[IssueDate]
,[FilePath]
,[BranchName]
,[DocType]
INTO #Results
FROM dbo.Polices
SELECT @RecordCount = COUNT(*)
FROM #Results
SELECT * FROM #Results
WHERE RowNumber BETWEEN(@PageIndex -1) * @PageSize + 1 AND(((@PageIndex -1) * @PageSize + 1) + @PageSize) - 1
DROP TABLE #Results
END
我需要的是传递多个策略并根据它过滤结果。 我也需要这个参数作为defualt如果它是空的我需要选择不插入它在Where condtion 我正在使用SQL Server 2008 R2。