---
title: "分页查询的SQL存储过程"
author: "cpine"
date: "2010-01-29T11:40:17Z"
tags: []
categories: ["编程语言"]
slug: "sql"
draft: false
lastmod: "2010-01-29T11:40:17Z"
id: 583197
url: "https://cpine.iteye.com/blog/583197"
---

```
select top 5 * from student

alter procedure selectTopN
@count int
as
begin
declare @topCount varchar(1000)
set @topCount='select top '+convert(varchar,@count)+' * from student'
exec(@topCount)
end
 

exec selectTopN 10
```