Set ansi_nulls on
Set quoted_identifier on
Go
Alter procedure [DBO]. [ccc_isuploadphysicaldel]
As
Begin
-- ============= Author: Connie Chen
-- ============= Create time: 16:04:00. 893
-- ============== Description: Get all fids from Table ccc_tadetail. It prepare to upload into as400.
Declare @ detailfids varchar (2000)
Select
@ Detailfids = coalesce (@ detailfids + ',', '') + Cast (ccc_del_tadetail.deletiontableprimaryid as varchar (10 ))
From
(
Select Top 100 * From ccc_deletionsync
Where
Deletiontable = 1 and isuploaded is null
) Ccc_del_tadetail
-- ============= Author: Connie Chen
-- ============= Create time: 16:04:00. 893
-- ============== Description: Get all fids from Table ccc_deliveryconfirminfo. It prepare to upload into as400.
Declare @ deliveryconfirmids varchar (2000)
Select
@ Deliveryconfirmids = coalesce (@ deliveryconfirmids + ',', '') + Cast (ccc_del_deliveryconfirm.deletiontableprimaryid as varchar (10 ))
From
(
Select Top 100 * From ccc_deletionsync
Where
Deletiontable = 2 and isuploaded is null
) Ccc_del_deliveryconfirm
-- ============= Author: Connie Chen
-- ============= Create time: 16:04:00. 893
-- ============== Description: Get all ID from Table ccc_deletionsync
Select
Len (@ detailfids) as idlens, @ detailfids as IDS, deletiontable, 'ccc _ tadetail 'As deletiontablename
From
Ccc_deletionsync
Where deletiontable = 1 and isuploaded is null
Group by deletiontable
Union
(
Select
Len (@ deliveryconfirmids) as idlens, @ deliveryconfirmids as IDS, deletiontable, 'ccc _ dliveryconfrimin 'As deletiontablename
From
Ccc_deletionsync
Where deletiontable = 2 and isuploaded is null
Group by deletiontable
)
End