用SQL获取月份的工作日
来源:互联网 发布:如何做网络推广 编辑:程序博客网 时间:2024/06/01 07:18
declare @int_month int,@max_day int,@strDate varchar(10)
set @int_month=7 --输入月份
if @int_month between 1 and 12
begin
select @strDate=cast(year(getdate()) as varchar(10))+'-'+cast(@int_month+1 as varchar(10))+'-'+cast('1' as varchar)
select @max_day=day(dateadd(day,-1,convert(varchar(10),@strDate,120)))
declare @t table(sdate smalldatetime)
declare @i int
set @i=1
while(@i<=@max_day)
begin
insert into @t select cast(year(getdate()) as varchar(10))+'-'+cast(@int_month as varchar(10))+'-'+cast(@i as varchar)
set @i=@i+1
end
select count(1) from @t where datepart(dw,sdate)-1 not in (0,6)
end
else
print '月份错误'
set @int_month=7 --输入月份
if @int_month between 1 and 12
begin
select @strDate=cast(year(getdate()) as varchar(10))+'-'+cast(@int_month+1 as varchar(10))+'-'+cast('1' as varchar)
select @max_day=day(dateadd(day,-1,convert(varchar(10),@strDate,120)))
declare @t table(sdate smalldatetime)
declare @i int
set @i=1
while(@i<=@max_day)
begin
insert into @t select cast(year(getdate()) as varchar(10))+'-'+cast(@int_month as varchar(10))+'-'+cast(@i as varchar)
set @i=@i+1
end
select count(1) from @t where datepart(dw,sdate)-1 not in (0,6)
end
else
print '月份错误'
- 用SQL获取月份的工作日
- SQL 获取指定月份的天数
- SQL语句获取日期的月份
- java获取当月的工作日
- SQL 获取指定月份的所有日期,SQL日期分页
- sql中获取上个月份
- SQL Server中获取指定时间段内的所有月份
- SQL语句获取当月的前一个月份和下一个月份
- C#获取时间段内的工作日
- oracle 获取俩个日期间的工作日
- 获取指定日期范围的工作日日期
- php获取某一年的工作日列表
- Python 脚本获取上一个工作日的方法
- php获取之前五天的工作日
- iOS获取当前月份的上一个月份
- 获取指定月份的天数
- php 获取月份的天数
- php 时间月份的获取
- J2ME学习笔记(二)
- Log4j简明手册(2/3)
- Struts国际化问题
- J2ME学习笔记(三)-----学习MIDlets
- TOMCAT笔记(一)之 目录、虚拟主机、SERVER.XML、TOO
- 用SQL获取月份的工作日
- 几个常用开源项目的地址荟萃(转)
- 功能不错的分页存储过程,可支持多表查询,任意排序
- [隆重介绍]Gemini:.NET project issue tracking...
- DecimalFormat的疑惑
- 您可能不知道的.Net2.0小技巧
- 中断19引导加载程序过程详解
- rs.getString VS rs.getDouble
- 新闻内容分页