Sql server

1.update statistics [表名] 更新表的统计信息

2.Case When

(参考:http://www.cnblogs.com/yaozhenpeng/p/6796692.html)

select name ,

valiad=case valiad when 'Y' THEN '有效' when 'N' then ''无效 else '' end

from table1

3.级联更新、级联删除

级联更新:
update S1
set S1.Name=S2.Name
from A表 as S1,B表 as S2
where S1.ID=S2.id

级联删除:
delete S1
FROM A AS S1,B AS S2
WHERE S1.ID=S2.ID

4.首行缩进

shift+Tab(多行)

posted @ 2017-05-02 14:35  __初  阅读(147)  评论(0编辑  收藏  举报