有重复数据主要有一下几种情况:1.存在两条完全相同的纪录 这是最简单的一种情况,用关键字distinct就可以去掉 example: select distinct * from table(表名) where (条件)2.存在部分字段相同的纪录(有主键id即唯一键) 如果是这种...
分类:
其他好文 时间:
2014-06-18 15:08:18
阅读次数:
173
DBCC DROPCLEANBUFFERS --清空缓存 SET STATISTICS IO ON --开启IO统计 SELECT * FROM Person --查询语句 预读:用估计信息,去硬盘读取数据到缓存。预读100次,也就是估计将要从硬盘中读取了100页数据到缓存...
分类:
数据库 时间:
2014-06-18 14:42:26
阅读次数:
282
create procedure pro_aaa( @canshu1nvarchar(200), @canshu2nvarchar(200)) as begin declare @strsql nvarchar(2000) set @strsql='select * from table1 wher...
分类:
其他好文 时间:
2014-06-18 12:59:40
阅读次数:
191
Hibernate 默认总共支持 13 种生成策略 :
1. increment
2. identity
3. sequence
4. hilo
5. seqhilo
6. uuid
7. uuid.hex
8. guid
9. native
10. assigned
11. select
12. f...
分类:
系统相关 时间:
2014-06-17 22:30:41
阅读次数:
450
SELECT * FROM tab WHERE time = (SELECT MAX(time) FROM tab) 找出时间最近的一条记录
分类:
数据库 时间:
2014-06-17 20:13:30
阅读次数:
203
rownum是oracle的一个伪劣,它的顺序根据从表中获取记录的顺序递增,这里要注意的是:由于记录在表中是无序存放的,因此你无法通过简单的rownum和order by的组合获得类似TOP N的结果。
我们的测试数据如下:
select * from test;
ID NAME
---------- --------------------
1 A...
分类:
数据库 时间:
2014-06-17 19:29:14
阅读次数:
275
--创建过程,参数为sys_refcursor,为out型
create or replace procedure aabbsys_refcursor(o out sys_refcursor) is
begin
open o for select * from basplumain;
end;
---
--测试过程,使用aabbsys_refcursor传出的值
create or repla...
分类:
其他好文 时间:
2014-06-17 16:04:12
阅读次数:
180
ocp 053648.Note the following statements that use flashback technology:1. FLASHBACK TABLE TO SCN ;2. SELECT * FROM AS OF SCN 123456;3.FLASHBACKTABLE.....
分类:
其他好文 时间:
2014-06-17 16:01:01
阅读次数:
220
SELECT YEAR(CollectionDate) AS Year, DATEDIFF(quarter, CAST(DATEPART(YEAR, CollectionDate) AS NVARCHAR(4)) + '-01-01', CollectionDate) + 1 AS Quarter,...
分类:
数据库 时间:
2014-06-17 15:52:01
阅读次数:
206
SQL服务器更改名称后 编写人:CC阿爸 2014-6-15 在日常SQL 2005数据库的操作中,有时安装完成数据库后,再更名,造成部分SQL服务不能正常使用(在SQL2000 时,想都别想更名了) select serverproperty('servername'), @...
分类:
数据库 时间:
2014-06-17 13:18:24
阅读次数:
318