USE [IpointsInterface]
GO
/****** Object: StoredProcedure [dbo].[VendorProductType_SelectPage] Script Date: 11/07/2012 17:59:06 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Wayne Chen
-- Create date: 2012-11-07
-- Description: 获取大类对象分页
-- =============================================
ALTER PROCEDURE [dbo].[VendorProductType_SelectPage]
@VendorIndex INT,
@TypeCode varchar(32),
@TypeName NVARCHAR(50),
@PageSize int,
@PageIndex int,
@TotalCount int output
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Start INT,@End INT
SET @Start = (@PageIndex -1) * @PageSize+1;
SET @End = @PageIndex *@PageSize
-- Insert statements for procedure here
SELECT @TotalCount = COUNT(1) FROM VendorProductType(NOLOCK)
WHERE VendorIndex=@VendorIndex
AND (TypeCode LIKE @TypeCode)
AND (TypeName LIKE @TypeName)
SELECT * FROM(
SELECT ROW_NUMBER() OVER(ORDER BY VendorProductTypeIndex ASC) iRowNum,* FROM VendorProductType(NOLOCK)
WHERE VendorIndex=@VendorIndex
AND (TypeCode LIKE @TypeCode)
AND (TypeName LIKE @TypeName)) AS [TMP]
WHERE iRowNum BETWEEN @Start AND @End
END
具体怎么调用
数据库中调用就是 exec 存储过程名字 参数1,参数2 如果有输出参数 需要定义output..
程序中调用就需要传参了 sqlparameter 封装好跟存储过程名字一起发到数据库
@chenping2008:可不可以就上面的列子写一个调用的示例啊
exec VendorProductType_SelectPage 参数1,参数2。。。
楼主指的是数据库中的调用呢,还是程序中的?
@chenping2008: 数据库中的啊
exec 存储过程名 参数1,参数2
不管是在程序中还是在数据库中都是一样的用法