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

sql 2005 强制使用执行计划 T—SQl

select * from tt t inner loop join ss s with(nolock) on s.c=t.c
 
 使用 nested join
select * from tt t inner merge join ss s with(nolock) on s.c=t.c
 
 使用 merge join
 
select * from tt t inner hash join ss s with(nolock) on s.c=t.c
 
使用  hash jion
 
nolock 不允许锁 
 
 
 
 
Microsoft SQL Server sometimes uses hash and merge joins when querying large tables when uncomplicated nested loop joins would result in better performance and less server impact. In many such cases, query times go from many milliseconds to many seconds because hash table joins require that large amounts of data be processed and temporarily stored, and merge joins require sorting and then processing similarly large amounts of data.
This is fine for one-time administrative "fact finding" queries where you don't have or want the indices needed to optimize the query, and you're willing to wait the seconds or minutes it takes to get results.
For day-in-and-day-out application queries, however, you don't want your database engine to be hashing or sorting hundreds of thousands or millions of rows, especially when the end result is only a small number of rows.


相关文档:

sql server 表结构数据字典的sql语句

SELECT TOP (100) PERCENT
CASE WHEN a.colorder = 1 THEN d .name ELSE '' END AS 表名, CASE WHEN a.colorder = 1 THEN isnull(f.value, '')
ELSE '' END AS 表说明, a.colorder AS 字段序号, a.name AS 字段名, CASE WHEN COLUMNPROPERTY(a.id, a.name, 'IsIdentity')
= 1 THEN '√' ELSE '' END AS 标识, CA ......

猜猜看,Hibernate会执行几句SQL(一)

POEAA中介绍了ORM中最重要的模式之一:Unit Of Work。看似简单,实现起来却非常复杂。
Hibernate完美的实现了这个模式。以下我用一系列的例子来分析Hibernate的处理机制
下面有三个例子,猜猜看Hibernate会执行几句SQL(省略事务处理代码,实体对象叫User,假设主键是自增型的)
例1:
User user = new User();
user.setN ......

彻底删除sql server 2005

1.Stop 所有服务
 
2.用 Windows Install Clean Up 工具卸载SQL 2005组件
 
3.用SrvInstw.exe删除所有SQL服务
 
4.清除注册表
   a. 将HKEY_CURRENT_USER---Software----Microsoft下的Microsoft SQL Server文件夹全部删除
   b. 将HKEY_LOCAL_mACHINE---SOFTWARE---Microsoft下 ......

sql server里将十六进制转换成十进制

在网上找了很多,总是不知道怎么用,于是自己写了一个:
declare @strHex char(5),
@len int,
@intOut int,
@i int,
@charint int
set @strHex = '20'
set @len = len(rtrim(@strHex))
set @i = 1
set @intOut = 0
while @i <= @len
begin
set @charint = case substring(upper(rtrim(ltrim(@strHex))) ......

时间差计算: SQL Server DATEDIFF() 函数

SQL Server DATEDIFF() 函数
定义和用法
DATEDIFF() 函数返回两个日期之间的天数。
语法
DATEDIFF(datepart,startdate,enddate)
startdate 和 enddate 参数是合法的日期表达式。
datepart 参数可以是下列的值:
datepart缩写

yy, yyyy
季度
qq, q

mm, m
年中的日
dy, y

dd, d

wk, ww
星期 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号