易截截图软件、单文件、免安装、纯绿色、仅160KB

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    


相关文档:

sql 时间格式转换

语句及查询结果:
SELECT CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
SELECT CONVERT(varchar(100), GETDATE(), 1): 05/16/06
SELECT CONVERT(varchar(100), GETDATE(), 2): 06.05.16
SELECT CONVERT(varchar(100), GETDATE(), 3): 16/05/06
SELECT CONVERT(varchar(100), GETDATE(), 4): 16.05.06
SE ......

Oracle 10g SQL*Plus命令实践


1、连接Oracle数据库
启动SQL*Plus,要求输入User Name、Password、Host String这三个参数,例如我在安装的时候默认创建的数据库为orcl,也就是SID,密码也为orcl,对应上面的三个参数如下所示:
User Name:orcl
Password:orcl
Host String:orcl as sysdba
就可以登录成功。
或者也可以使用默认的scott来登录: ......

SQL语句使用 一个题目涉及到的50个Sql语句

转载自:http://www.diybl.com/course/7_databases/sql/sqlServer/2009124/154621_2.html
一个题目涉及到的50个Sql语句
Student(S#,Sname,Sage,Ssex) 学生表
Course(C#,Cname,T#) 课程表
SC(S#,C#,score) 成绩表
Teacher(T#,Tname) 教师表
问题:
1、查询“001”课程比“002”课程成绩高的 ......

SQL SERVER中交和差的实现

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
( ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号