随笔分类 -  Sever-SQL

摘要:直接执行下面的SQL语句,: --1.清空日志dump tran dbname with no_log --2.截断事务日志:backup log dbname with no_log --3.收缩数据库文件(如果不压缩,数据库的文件不会减小)dbcc shrinkdatabase(dbname) 执行过后看看日志文件是不是很小了,我一般都只有1M了。 阅读全文
posted @ 2013-02-17 09:16 天纯蓝 阅读(298) 评论(0) 推荐(0)
摘要:大数据量SQL 分页过程 阅读全文
posted @ 2009-06-26 15:34 天纯蓝 阅读(394) 评论(2) 推荐(0)
摘要:SQL2000的优化(转)总结的非常棒 阅读全文
posted @ 2009-06-25 09:14 天纯蓝 阅读(382) 评论(0) 推荐(0)
摘要:select employeeId, count(employeeId) as o from orders where employeeId in (select distinct employeeId from orders) GROUP BY employeeId Desc 阅读全文
posted @ 2008-12-05 17:25 天纯蓝 阅读(180) 评论(0) 推荐(0)
摘要:随机读取记录 阅读全文
posted @ 2008-10-06 11:33 天纯蓝 阅读(349) 评论(0) 推荐(0)
摘要:Code Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->--当前日期的周时间段 declare @today datetime select @today = convert(varchar(10), getda... 阅读全文
posted @ 2008-09-10 13:09 天纯蓝 阅读(448) 评论(0) 推荐(0)
摘要:SQL递归查询子类型 阅读全文
posted @ 2008-07-23 15:18 天纯蓝 阅读(466) 评论(0) 推荐(0)
摘要:SQL按拼音字母查询指定字段的做法 阅读全文
posted @ 2007-11-06 17:37 天纯蓝 阅读(1734) 评论(3) 推荐(0)
摘要:(转)动态SQL和PL/SQL的EXECUTE IMMEDIATE选项 阅读全文
posted @ 2007-07-12 17:19 天纯蓝 阅读(270) 评论(0) 推荐(0)
摘要:SQL遍历所有表建立临时表 阅读全文
posted @ 2007-07-06 11:56 天纯蓝 阅读(1449) 评论(0) 推荐(0)
摘要:存储过程中用到的年,月,周的函数 2007-06-01 09:13 周:Dateadd(wk,datediff(wk,0,getdate()),-1) Dateadd(wk,datediff(wk,0,getdate()),6) 月:Dateadd(mm,datediff(mm,0,getda... 阅读全文
posted @ 2007-06-19 12:50 天纯蓝 阅读(291) 评论(0) 推荐(0)
摘要:SQL分页过程 阅读全文
posted @ 2007-03-14 14:45 天纯蓝 阅读(269) 评论(0) 推荐(0)
摘要:SQL自定义函数求当天最小时间和最大时间 阅读全文
posted @ 2007-03-14 14:43 天纯蓝 阅读(1799) 评论(0) 推荐(0)
摘要:求当前时间当月有多少天希望有谁能搜到,能用得上 阅读全文
posted @ 2007-03-14 14:40 天纯蓝 阅读(529) 评论(0) 推荐(0)
摘要:整理了一下SQL Server里面可能经常会用到的日期格式转换方法: 阅读全文
posted @ 2007-03-14 14:35 天纯蓝 阅读(229) 评论(0) 推荐(0)
摘要:SQLServer和Oracle的常用函数对比 阅读全文
posted @ 2007-03-14 13:57 天纯蓝 阅读(148) 评论(0) 推荐(0)