SQL分页
SQL分页
万能分页
.net代码
select top 每页显示的记录数 * from topic where id not in
(select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc)
order by id desc
select top 每页显示的记录数 * from topic where id not in
(select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc)
order by id desc
sql2005分页
.net代码
with temptbl as (
SELECT ROW_NUMBER() OVER (ORDER BY id desc)AS Row,
...
)
SELECT * from temptbl where Row between @startIndex and @endIndex
.net代码
select top 每页显示的记录数 * from topic where id not in
(select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc)
order by id desc
select top 每页显示的记录数 * from topic where id not in
(select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc)
order by id desc
sql2005分页
.net代码
with temptbl as (
SELECT ROW_NUMBER() OVER (ORDER BY id desc)AS Row,
...
)
SELECT * from temptbl where Row between @startIndex and @endIndex
相关文档:
*给多个变量赋值
function只能使用
set (a,b,c)=(select a,b,c from #);
procedure只能使用
select a,b,c into a,b,c from #
*function无法嵌套调用带有inout或out参数的procedure,现象为:无法创建。
今天的进展结论是:
function可以调用任何procedure,但必须声明为modifies sql data,同时必须返回table ......
原帖及讨论:http://bbs.bc-cn.net/dispbbs.asp?boardid=12&id=140292
* 最近因为开发活动需要,用上了Eclipse,并要求使用精简版的SQL数据库(即SQL Server 2005)来进行开发项目 *
1.准备工作: 准备相关的软件(Eclipse除外,开源软件可以从官网下载)
<1> .Microsoft   ......
create table aaa
(
id int primary key ,
name varchar(30) not null
)
create table bbb
(
id int primary key ,
name varchar(30) not null
)
--交
select * from aaa
where exists
(
select * from bbb where aaa.id=bbb.id and aaa.name = bbb.name
)
--差
select *
from bbb
where not exists
(
......
-->目录
-->SQL Server 构架
-->实施细则
-->最大容量说明
最大值(数量或大小)
对象 SQL Server 7.0 SQL Server 2000
批处理大小 65,536 * 网络数据包大小1 65,536 * 网络数据包大小1
每个短字符串列的字节数 8,000 8,000
每个 text、ntext、或 image 列的字节数 2 GB-2 2 GB-2
每个 GROU ......
配置源程序
附加数据库SQL Server 2005
(1)将TM\01\App_Data文件夹中的db_SIS.mdf和db_SIS_log.ldf文件拷贝到SQL Server 2005安装路径下的MSSQL.1\MSSQL\Data目录下。
(2)选择开始/程序/Microsoft SQL Server 2005/SQL Server Management Studio项,进入到“连接到服务器”页面,如图1.1所示。
图1.1&nbs ......