离职时间 不为空 的数据保存到离职表中 select 字段 from 临时表 into 离职表 where 离职时间<>''
离职时间 为空 的该条数据保存到在职表中, select 字段 from 临时表 into 在职表 where 离职时间=''
这个如果是数据库的接口可以这样做,如何是web service 直接在程序里判断
------解决方案--------------------
SQL code
declare FUserID_cursor cursor for
select t.FUserID
from #TempTable t
--where t.FQuitPostDate <>''//分开处理时用
declare @FUserID_info NVARCHAR (50)
open FUserID_cursor
fetch next from FUserID_cursor into @FUserID_info
while(@@FETCH_STATUS=0)
begin
declare @FQuitPostDate as NVARCHAR (50)
select @FQuitPostDate = FQuitPostDate from #TempTable where FUserID = @FUserID_info
if @FQuitPostDate <>''
begin
INSERT INTO FIsSAPData (
FUserID,
FUserName,
FEmail,
FPosition,
FQuitPostDate,
)
SELECT
FUserID,
FUserName,
FEmail,
FPosition,
FQuitPostDate,
FROM #TempTable
where FUserID = @FUserID_info
fetch next from FUserID_cursor into @FUserID_info
end
else
begin
INSERT INTO FIsNotSAPData (
FUserID,
FUserName,
FEmail,
FPosition,
FQuitPostDate,
)
SELECT
FUserID,
FUserName,
FEmail,
FPosition,
FQuitPostDate,
FROM #TempTable
where FUserID = @FUserID_info
fetch next from FUserID_cursor into @FUserID_info
end
end
------解决方案--------------------