惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
GbyAI
GbyAI
aimingoo的专栏
aimingoo的专栏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
腾讯CDC
博客园 - Franky
Engineering at Meta
Engineering at Meta
C
Check Point Blog
T
The Blog of Author Tim Ferriss
有赞技术团队
有赞技术团队
Microsoft Azure Blog
Microsoft Azure Blog
MyScale Blog
MyScale Blog
I
InfoQ
Blog — PlanetScale
Blog — PlanetScale
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
N
Netflix TechBlog - Medium
Last Week in AI
Last Week in AI
S
SegmentFault 最新的问题
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学

博客园 - Blue

个已实现的例子:通过Javascript在页面中直接调用Office Communicator API - Blue cmd脚本(C# 清缓存) - Blue - 博客园 isql脚本编写创建数据库(SQL Server2000) 怎样踢mstsc占用者 copy:键盘按键和键盘对应代码表 Thread简单概念 转:ListView 中添加大数据量解决屏幕刷新“闪”的现象 Regsvr32命令全攻略 导入导出CVS文件遇到的问题 - Blue - 博客园 一个字段存很多枚举值,然后从字段取出的方法 關於泛型的資料 索引器的两种用法 在建表时使用DEFAULT是很有用的 关于web service的验证 临时表有时很有用 在GROUP语句中还可以增加很多内容 注意insert语句写法 case的用法 尽量减少使用游标
SQL中计算月初和月末
Blue · 2006-04-12 · via 博客园 - Blue

--月初   本月一号
set @BeginDate = convert(varchar(8),datepart(year,@WhichMonth))+'-'+convert(varchar(8),datepart(m,@WhichMonth))+'-1'
--月末 下月一号减一天
set @EndDate = dateadd(day,-1,convert(varchar(8),datepart(year,dateadd(m,1,@WhichMonth)))+'-'+convert(varchar(8),datepart(m,dateadd(m,1,@WhichMonth)))+'-1 23:59:59')

简化
set @BeginDate = convert(varchar(8),@WhichMonth,120)+'1'

set @EndDate = dateadd(day,-1,convert(varchar(8),dateadd(m,1,@WhichMonth),120)+'1 23:59:59')