日期:2014-05-17 浏览次数:20535 次
drop proc OA_pfm_attend_group_toExempt
go
Create proc OA_pfm_attend_group_toExempt
@begin datetime,
@end datetime
as
begin
set nocount on
set ANSI_WARNINGS on
set ANSI_NULLS on
--declare @begin datetime
--declare @end datetime
--set @begin = @beginSTR
--set @end = @endSTR
create table #query_Table_Temp (
checkDay datetime not null
,checkIn datetime not null
,checkOut datetime not null
,isHoliday bit not null default 0
)
declare @checkDay datetime
declare @checkIn datetime
declare @checkOut datetime
set @checkDay = @begin
while (@checkDay<=@end) begin
set @checkIn = convert(varchar(10),@checkDay)+' 08:35:00'
set @checkOut = convert(varchar(10),@checkDay)+' 18:30:00'
insert into #query_Table_Temp (checkDay,checkIn,checkOut) values(@checkDay,@checkIn,@checkOut)
--update #query_Table_Temp set isHoliday=1 where checkDay in (select Holiday from OPENQUERY(OAMySQL, 'SELECT * from a_rest_holiday'))
set @checkDay = dateadd(day,1,@checkDay)
end
delete from #query_Table_Temp where checkDay in (select Holiday from OPENQUERY(OAMySQL, 'SELECT * from a_rest_holiday'))--这句引起出错,把这些调用链接服务器的所有语句删除就举出错
create table #attend_Temp(
checkDay datetime not null
,userID int
,Name varchar(30)
,User_ID varchar(30)
,dept_ID int
,defCheckIn datetime
,defCheckOut datetime
,checkIn datetime null
,checkOut datetime null
,rest bit not null default 0
,leave1 bit not null default 0
,leave2 bit not null default 0
,out1 bit not null default 0
,out2 bit not null default 0
,evection bit not null default 0
)
insert #attend_Temp (checkDay,userID,Name,User_I