SQL Server 得到行号的SQL
SQL Server 得到行号的SQL
使用临时表:
select id=identity(int,1,1),value into #temp from YourTable
select * from #temp
drop table #temp
取得第11到20行记录:
select IDENTITY(int, 1,1) AS ID_Num,* into #temp from 表
select * from #temp where ID_Num>10 and ID_Num<=20
或
SELECT Top @PageSize *
from T
WHERE SortField NOT IN (SELECT TOP @PageSize * @Pagei SortField
from T
ORDER BY SortField
)
ORDER BY SortField
REF:http://topic.csdn.net/t/20021022/21/1116380.html
相关文档:
/*
本文专注于将Excel导入SQL SERVER2005数据库
此路径下的这个工具,是SQL SERVER2005 用来导入导出数据的工具。
C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTSWizard.exe
一般在数据库名上--右键-->Tasks-->Import Data -->界面就出来了,和点击上面的工具是一个东西。
首次使用这个D ......
#Region " 命名空间 "
Imports System.Data
Imports System.Data.SqlClient
#End Region
Public Class DBCommon
Implements IDisposable
#Region " 成员变量 "
Private conn As SqlConnection
Private cmd As SqlCommand
Private trans As SqlTransaction
#End Region
#Region " 构造函数 "
......
SQL宝典
SQL必知必会第三版
SQL入门经典第四版
Sams Teach Yourself SQL in 10 Minutes Third Edition
SQL The Complete Reference
......
Suppose we have a recursive hierarchy stored in a relational database and we want to write it to XML. This might be for a variety of reasons – e.g. as a pre-cached input to a UI control, to export to another system using a pre-defined format, etc.
In SQL Server 2000, in order to ......