统计加班时间的存储过程。
来源:互联网 发布:python pika 编辑:程序博客网 时间:2024/05/16 10:53
CREATE PROCEDURE dt_jb_tg
(
@fristtime int,
@lasttime int,
@depid int,
@IntDateTypeID int
)
AS
Declare @S1 Nvarchar(4000),@S2 Nvarchar(4000),@S3 Nvarchar(4000)
Set @S1=''
Set @S2=''
Select @S1=@S1+',SUM(Case IntDay When '+Rtrim(IntDay)+N' Then IntHoursYd Else 0 End) As '''+Rtrim(IntDay)+'''',
@S2=@S2+',SUM(Case IntDay When '+Rtrim(IntDay)+N' Then IntHoursYx Else 0 End) As '''+Rtrim(IntDay)+''''
From vwTG where intyear*10000+intmonth*100+intday between @fristtime and @lasttime and UserDeptID=@depid and IntDateTypeID=@IntDateTypeID Group By IntDay Order By IntDay
EXEC(N'Select * From(Select 姓名+N''预定加班时间'' As 姓名,工号 '+@S1+N',SUM(IntHoursYd) As 合计 From vwTG where intyear*10000+intmonth*100+intday between ('+@fristtime+') and ('+@lasttime+') and UserDeptID=('+ @depid +') and IntDateTypeID=('+ @IntDateTypeID +') Group By 姓名+N''预定加班时间'',工号 Union All Select 姓名,工号'+@S2+N',SUM(IntHoursYx) As 合计 From vwTG where intyear*10000+intmonth*100+intday between ('+@fristtime+') and ('+@lasttime+') and UserDeptID=('+ @depid +') and IntDateTypeID=('+ @IntDateTypeID +') Group By 姓名,工号) A Order By (Case 姓名 When N''合计'' Then 1 Else 0 End), 工号,姓名 Desc')
GO
(
@fristtime int,
@lasttime int,
@depid int,
@IntDateTypeID int
)
AS
Declare @S1 Nvarchar(4000),@S2 Nvarchar(4000),@S3 Nvarchar(4000)
Set @S1=''
Set @S2=''
Select @S1=@S1+',SUM(Case IntDay When '+Rtrim(IntDay)+N' Then IntHoursYd Else 0 End) As '''+Rtrim(IntDay)+'''',
@S2=@S2+',SUM(Case IntDay When '+Rtrim(IntDay)+N' Then IntHoursYx Else 0 End) As '''+Rtrim(IntDay)+''''
From vwTG where intyear*10000+intmonth*100+intday between @fristtime and @lasttime and UserDeptID=@depid and IntDateTypeID=@IntDateTypeID Group By IntDay Order By IntDay
EXEC(N'Select * From(Select 姓名+N''预定加班时间'' As 姓名,工号 '+@S1+N',SUM(IntHoursYd) As 合计 From vwTG where intyear*10000+intmonth*100+intday between ('+@fristtime+') and ('+@lasttime+') and UserDeptID=('+ @depid +') and IntDateTypeID=('+ @IntDateTypeID +') Group By 姓名+N''预定加班时间'',工号 Union All Select 姓名,工号'+@S2+N',SUM(IntHoursYx) As 合计 From vwTG where intyear*10000+intmonth*100+intday between ('+@fristtime+') and ('+@lasttime+') and UserDeptID=('+ @depid +') and IntDateTypeID=('+ @IntDateTypeID +') Group By 姓名,工号) A Order By (Case 姓名 When N''合计'' Then 1 Else 0 End), 工号,姓名 Desc')
GO
- 统计加班时间的存储过程。
- NC休假加班存储过程
- 今天写的统计的存储过程
- 交叉统计报表存储过程的实现
- 历史数据统计-存储过程的应用
- Oracle 搜集统计信息的存储过程
- oracle存储过程执行时间的统计
- orcale存储过程(统计)
- 存储过程统计计算
- c#如何使用webservice、存储过程及存储过程的创建(简单模仿类似QQ统计用户在线时间为例)
- oracle 存储过程的时间计算
- 存储过程参数的时间默认值解决方法
- 存储过程参数的时间默认值解决方法
- 查询存储过程的最后修改时间
- 存储过程运行时间
- 统计不固定栏目的工资年报的存储过程
- 对统计的结果进行分页的存储过程
- 统计不固定栏目的工资年报的存储过程
- 数据日本——不可轻视的日本实力
- JAVASCRIPT中事件的思考
- 在Solaris下更改IP地址
- UNION合并多个结果集
- solaris上配置DNS客户端
- 统计加班时间的存储过程。
- solaris9忘了root密码怎么办?
- 解释:ASP.NET 2.0 中的窗体身份验证
- C#控件捕获按键事件
- 在SOLARIS下如何更改主机名
- Eclipse中配置Ruby on rails
- ORACLE按照比划、部首和拼音排序的实现
- C++资源之不完全导引(转)
- 在WAS下创建安全应用程序