压缩数据库和表 (SQL SERVER 2008)
Database Level
- shrinkdb
- shrinkfile
SQL Server 2008
1) Right click database
2) Tasks
3) Shrink
4) Database or file
Table level
- compression
SQL Server 2008
1) Right click table
2) Storage
3) Manage Compression
相关文档:
在网上看到一个很好的例子讲解in和exists的区别,这里备忘下。
本示例所示查询查找由位于以字母 B 开头的城市中的任一出版商出版的书名:
USE pubs
SELECT title
from titles WHERE EXISTS
(SELECT *
from publishers
WHERE pub_id = titles.pub_id ......
--------------------------------------------------------------------------
-- Author : htl258(Tony)
-- Date : 2010-04-23 08:08:36
-- Version:Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86)
-- Jul  ......
函数如下
CREATE FUNCTION StockBalance_AmountIn(@SortID int)
RETURNS numeric(18,4)
AS
BEGIN
Declare @dblReturn numeric(18,4)
Select @dblReturn = SUM(AmountCurrentMonthIn) from AT_Materiel_StockBalance Where SortID = @SortID
Return (@dblReturn)
END
......
SQL code
/*----------------------------------------------------------------
-- Author :feixianxxx(poofly)
-- Date :2010-04-20 20:10:41
-- Version:
-- Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (Intel X86)
Mar 29 2009 10:27:29
Copyright (c) 1988-2008 Microsoft Co ......