SQL分页查询
/*第几页必须大于1
select top 每页数量 * id
from @t a
where id not in
(select top (第几页-1)*每页数量 id
from @t b
)
*/
declare @lcSqlCommand nvarchar(100)
declare @t table (id int IDENTITY,orderDate datetime)
insert into @t
select orderDate
from Northwind..Orders
--返回第二页数据
select top 10 *
from @t a
where id not in
(select top 10 id
from @t b
)
相关文档:
/// <summary>
/// 返回分页SQL语句
/// </summary>
/// <param name="selectSql">查询SQL语句</param>
/// ......
1、截断日志:
backup log 数据库 with no_log
或:
清空日志
DUMP TRANSACTION 库名 WITH NO_LOG
2、 & ......
第一种采用预编译语句集,它内置了处理SQL注入的能力,只要使用它的setString方法传值即可:
String sql= "select * from users where username=? and password=?;
PreparedStatement preState = conn.prepareStatement(sql);
preState.setString(1, userName);
preState.setString(2, password);
ResultSet rs = ......
当Oracle数据库创建完成后,系统将会自动运行utlrp.sql这个脚本文件(D:\oracle\product\10.1.0\Db_1\RDBMS\ADMIN),但是,当通过定制安装类型的方式创建了数据库时,系统则不会运行utlrp.sql这个脚本,所以,建议在创建、更新或迁移一个数据库后,运行一下utlrp.sql这个脚本,以验证数据库安装是否成功,这样可以重新编译 ......
文本 nvarchar(n)
备注 ntext
数字(长整型) int
数字(整型) smallint
数字(单精度) real
数字(双精度) float
数字(字节) tinyint
货币 money
日期 smalldatetime
布尔 bit
附:转换成SQL的脚本。
ALTER TABLE tb ALTER COLUMN aa Byte 数字[字节]
ALTER TABLE tb ALTER COLUMN aa Long 数字[长整型]
ALTER T ......