----臨時表 把數據抄寫到此表,然後做2個表的同步
SELECT [FA_NUMBER]
,[STATUS]
,[FA_REQUESTOR]
,[CALI_NUMBER]
,[AMT]
FROM [KSGAFA].[dbo].[FA_TEMP]
--以後有更新人員的資料請參考此処代碼即可
declare @fa_namber varchar(20)
declare @fa_request varchar(20)
declare c1 cursor for SELECT [FA_NUMBER],[FA_REQUESTOR]
FROM [KSGAFA].[dbo].[FA_TEMP]
open c1
fetch NEXT from c1 into @fa_namber, @fa_request
while @@FETCH_STATUS = 0
begin
/*----這邊更改數據并此行是否已經更新過
update *** set [FA_REQUESTOR]=@fa_request where ***.[FA_NUMBER]=@fa_namber
update [KSGAFA].[dbo].[FA_TEMP] set flag='Y' where
*/
select @fa_namber+'|'+@fa_request
fetch next from c1 into @fa_namber, @fa_request
end
close c1
DEALLOCATE c1