June 8, 2016 at 9:59 am
I have a package where I loop through different accounts.
I have a Master table where I set the status of flag to 0 or 1 if the package runs for that account for that date then updating that flag to 1 for success 0 for failure
i want to truncate the table for each account in stage based on that flag status , how do we do that in ssis?
June 8, 2016 at 10:02 am
Just to be clear, your not truncating this mater table? Are you saying that each account has it's own table and that you want to truncate that table based on the flag? If so, is the table name stored in the Master Table along with the account flag?
June 8, 2016 at 10:06 am
Master table only updates the account ran successful or not for particular date.
Master table format
Account date statusflag
12345 2016-04-02 1
67890 2016-04-02 0
There is a table which has data for these two accounts with dates
so need to check master table and check if any of the account is failure then do not truncate else truncate
June 8, 2016 at 10:14 am
I have a execute task beginning of the logic in which i have this logic
Declare @Truncate bit
BEGIN TRY
EXEC [GetLoadStatus]
@Query = N'accountname',
@StatusFlag = @Truncate OUTPUT
IF @Truncate = 0
BEGIN
Truncate Table TableA
END
END TRY
Storedprocedure takes accountname as input and get the statusflag as output
June 8, 2016 at 10:33 am
June 8, 2016 at 10:34 am
So your problem is solved?
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
June 8, 2016 at 11:18 am
komal145 (6/8/2016)
I have a execute task beginning of the logic in which i have this logicDeclare @Truncate bit
BEGIN TRY
EXEC [GetLoadStatus]
@Query = N'accountname',
@StatusFlag = @Truncate OUTPUT
IF @Truncate = 0
BEGIN
Truncate Table TableA
END
END TRY
Storedprocedure takes accountname as input and get the statusflag as output
Again, does each account have its own table or are all accounts stored in TableA? If the latter, then you don't want to truncate as that deletes everything, EVERYTHING.
June 8, 2016 at 11:30 am
all accounts are stored in TableA witrh dates specified
June 8, 2016 at 11:36 am
komal145 (6/8/2016)
all accounts are stored in TableA witrh dates specified
Then TRUNCATE TABLE TableA will do just that, truncate the table of all data regardless if any of the data should be kept. You need to us a DELETE with a WHERE clause to delete the appropriate data that needs to be deleted.
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply