Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Data Transfer through SSIS Expand / Collapse
Author
Message
Posted Wednesday, December 18, 2013 5:10 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Thursday, June 26, 2014 4:08 AM
Points: 708, Visits: 3,286
kapil_kk (12/18/2013)
Abu Dina (12/18/2013)
+1 to Koens's suggestion.

I like to keep things simple so I would link the Data Flow Task to an Execute SQL Task (with On Success precedence constraint) that contains your UPDATE statement.

I am also thinking doing in that way only but little confuse that If I write query using Precedence constraint as Succees in ExecuteSQLTask as

Update table1
Set StatusFlag = 1

Then does it update only those rows which comes from source for StatusFlag = 0 or it will update the statusflag = 1 for whole table...


kapil kapil kapil..... what's wrong bro?

You're transferring all records where StatusFlag = 0 so your UPDATE statement will be changing all records with StatusFlag = 0 to StatusF;ag = 1 (in other words updating the rows you've just transferred).

UPDATE YourTable
SET StatusFlag = 1
WHERE StatusFlag = 0



---------------------------------------------------------


It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens

Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
Post #1524051
Posted Wednesday, December 18, 2013 5:14 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 3:18 PM
Points: 13,312, Visits: 10,178
Abu Dina (12/18/2013)


kapil kapil kapil..... what's wrong bro?

You're transferring all records where StatusFlag = 0 so your UPDATE statement will be changing all records with StatusFlag = 0 to StatusF;ag = 1 (in other words updating the rows you've just transferred).

UPDATE YourTable
SET StatusFlag = 1
WHERE StatusFlag = 0



True if you are updating the source table. Not necessarily true when updating the destination table.

ps: you were quick with your edit




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1524054
Posted Wednesday, December 18, 2013 5:20 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, July 25, 2014 12:34 AM
Points: 1,888, Visits: 2,326
Koen Verbeeck (12/18/2013)
kapil_kk (12/18/2013)
Abu Dina (12/18/2013)
+1 to Koens's suggestion.

I like to keep things simple so I would link the Data Flow Task to an Execute SQL Task (with On Success precedence constraint) that contains your UPDATE statement.

I am also thinking doing in that way only but little confuse that If I write query using Precedence constraint as Succees in ExecuteSQLTask as

Update table1
Set StatusFlag = 1

Then does it update only those rows which comes from source for StatusFlag = 0 or it will update the statusflag = 1 for whole table...


It will update the entire table.
Again, clear requirements please.

I have to transfer data from table1 to table2 which has same structure.. From table1 only those rows should get transferred whose statusflag = 0 to table2. After data gets transferred change the status flag to 1 for those rows... I think now its get cleared to you



_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1524055
Posted Wednesday, December 18, 2013 5:22 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 3:18 PM
Points: 13,312, Visits: 10,178
kapil_kk (12/18/2013)
[quote]
After data gets transferred change the status flag to 1 for those rows...


In which table? Table1 or table2?




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1524056
Posted Wednesday, December 18, 2013 5:25 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, July 25, 2014 12:34 AM
Points: 1,888, Visits: 2,326
Koen Verbeeck (12/18/2013)
kapil_kk (12/18/2013)
[quote]
After data gets transferred change the status flag to 1 for those rows...


In which table? Table1 or table2?

in table1 from which I am transferring data..



_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1524058
Posted Wednesday, December 18, 2013 5:28 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 3:18 PM
Points: 13,312, Visits: 10,178
kapil_kk (12/18/2013)
Koen Verbeeck (12/18/2013)
kapil_kk (12/18/2013)
[quote]
After data gets transferred change the status flag to 1 for those rows...


In which table? Table1 or table2?

in table1 from which I am transferring data..


Now it's clear.
Just use the UPDATE statement posted by Abu Dina. No staging table necessary.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1524059
Posted Wednesday, December 18, 2013 5:30 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Thursday, June 26, 2014 4:08 AM
Points: 708, Visits: 3,286
Koen Verbeeck (12/18/2013)ps: you were quick with your edit


LOL... you think that was quick? You should see me chatting up the ladies


---------------------------------------------------------


It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens

Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
Post #1524060
Posted Wednesday, December 18, 2013 5:54 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, July 25, 2014 12:34 AM
Points: 1,888, Visits: 2,326
Thanks a lot guys.. It worked


_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1524074
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse