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.
相关文档:
事务就是负责把一系列操作看做一个独立的逻辑单元,这些操作要么同时成功,要么同时失败。下面是一个经典的例子:
create procedure TransferMoeny
(
@fromAccountNo varchar(50),-- 转出账号
@ToAccountNo varchar(50),--转入账号
& ......
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的查询都没怎么在意,今天遇到一个关于左连接查询的问题。
Select uId ,uName,dpName
from users
left join dpart
on users.pid=1 where u.pid=dpart.pid
结果是把users所有结果查询出来,而不是pid为1的用户
原来on后面必须放连接条件,其他的条件放在where里面
感谢夏欢提出 ......
--以下文章为转载.
SQL注入漏洞全接触——入门篇
ZDNet 软件频道 更新时间:2007-08-20 作者:CSDN 来源:CSDN
本文关键词:漏洞 SQL Server SQL
随着B/S模式应用开发的发展,使用这种模式编写应用程序的程序员也越来越多。但是由于这个行业的入门门槛不高,程序员的水平及经验也参差不齐,相当大一部 ......