sqlserver分页(二)sqlserver2005千万级分页查询
在sqlserver2005下使用下面语句
WITH t AS (
SELECT ROW_NUMBER() OVER(ORDER BY id DESC) as row_number, id,ss
from Table4
)
Select ROW_NUMBER() OVER(ORDER BY id DESC) as row_number1,id,ss
from t
where row_number BETWEEN 11000011 and 11010020
sqlserver2000不支持该写法,该写法1千万条数据表中测试过。
相关文档:
SQL-Structured Query Language
--(开启SQL服务:net start mssqlserver)
--(在命令行中输入'sqlwb'命令可打开SQL管理器 )
--(如果要执行多条命令中的一条,鼠标选定后再按F5执行)
create database sales ......
1、查看原数据库备份情况:RESTORE FILELISTONLY from DISK = 'c:\NMGCNC-BABY_2009-4-1.dat' WITH NOUNLOAD, FILE = 1
2、进行数据库还原:
restore database babyAndwed from DISK = 'c:\NMGCNC-BABY_2009-4-1.dat' with move 'babyAndwed_Data' to
'c:\NMGCNC-BABY_Data.MDF',move 'babyAndwed_Log' to 'c:\NMGCNC-B ......
原文出处:http://www.cnblogs.com/luoht/archive/2010/03/01/1676049.html
用IN写出来的SQL的优点是比较容易写及清晰易懂,这比较适合现代软件开发的风格。
但是用IN的SQL性能总是比较低的,从SQL执行的步骤来分析用IN的SQL与不用IN的SQL有以下区别:
SQL试图将其转换成多个表的连接,如果转换不成功则先执行 ......
In the latest installment of the SQL Server interview questions, we will outline questions suitable for a DBA interview to assess the candidates skills related to SQL Server system databases. In this tip, the questions are there to read, but the answers are intentionally hidden to really test your s ......