28. November 2016
AndrewZhu
SqlServer
How to release Sql Server free space , here is the answer:
In Sql Server Management Studio, right click database name.
If you have already use commend:
DBCC SHRINKFILE
(1, NOTRUNCATE);
To shrink the database file , then ,select :
To release free space.
Here is script to get all table indexes by script rather than using SQL Server Management Studio:
SE
[More]
由于 SQL Server 会非常智能地使用第一次执行存储过程的参数生成执行计划表。于是使用不同参数执行同一个存储过程的性能表现迥异。 所以,不要试图用同一个存储过程通过接受不同参数组合来搞定一切,最佳办法是为每一个类型的操作使用单独的存储过程。 强烈推荐阅读这篇极其有诚意,又有技术含量的文章: http://www.sommarskog.se/query-plan-mysteries.html
举个例子, 有表 titles 和 sales, 通过 title_id 把salse 表左连接到title 表上. SELECT T.title_id, T.titleFROM titles T LEFT JOIN sales S on T.title_id = S.title_id WHERE S.stor_id = '7131' ORDER BY T.title 注意,上面这段代码里,右表条件放在 where 后面。 现在把右表条件移到 join 的on 下面 SELECT T.title_id, T.tit...
[More]
28. October 2014
xhinker
SqlServer
A table named "HistoryTable" stored duplicated history records: ThreadID Date Other columns 111-111 2014-10-27 ...
[More]