打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
求第一天是星期3的月份
这段代码是计算从本月起,第一天是星期3的月份。只取了前10个
declare @count int
set @count=1
declare @date datetime
declare @week int
select @date=dateadd(dd,-datepart(dd,getdate())+1,getdate())
while @count<=10
begin
 set datefirst 1
 select @week=datepart(weekday,@date)
if(@week=3)
begin
 set @count=@count+1
print substring(convert(char,@date,112),0,7)
select @date=dateadd(M,1,@date)
end
else
begin
 select @date=dateadd(M,1,@date)
end
end
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
SQL Server 中的时间算法总结 - MS-SQL Server / 基础类
SQLServer常用的日期和时间函数梳理
Sql server中对时间类型的字段转换
使用sql语句查询日期在一周内的数据
sql server日期时间函数
getDate()显示格式 转 与时间相关的SQL语句/sql获取当前时间
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服