2011年9月14日

打印日期段间的每一天

摘要: 需求:输入两个时间,打印出这两个日期间的所有天实现:declare @start datetime,@end datetimeset @start='20110830'set @end='20110918'while(@start<@end)beginprint CONVERT(nvarchar(8),@start,112)select @start=DATEADD(day,1,@start)end注:最近要写一些统计数据的sql,需要按天划分 阅读全文

posted @ 2011-09-14 22:48 雨渐渐 阅读(174) 评论(0) 推荐(0)

函数:isnull

摘要: 问题:警告: 聚合或其他 SET 操作消除了 Null 值create table tb(id int,num int)insert into tb select 1,10insert into tb select 1,20insert into tb select 2,80insert into tb select 2,nullselect id,sum(num)from tbgroup by id警告: 聚合或其他 SET 操作消除了 Null 值。(2 行受影响)解决方案:select id,sum(isnull(num,0))from tbgroup by id结论:msdn说明:当 阅读全文

posted @ 2011-09-14 20:57 雨渐渐 阅读(377) 评论(0) 推荐(0)

导航