SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Data Transfer through SSIS


Data Transfer through SSIS

Author
Message
Abu Dina
Abu Dina
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1263 Visits: 3323
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? :-P

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
Koen Verbeeck
Koen Verbeeck
One Orange Chip
One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)

Group: General Forum Members
Points: 27791 Visits: 13268
Abu Dina (12/18/2013)


kapil kapil kapil..... what's wrong bro? :-P

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?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
kapil_kk
kapil_kk
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3121 Visits: 2766
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/
Koen Verbeeck
Koen Verbeeck
One Orange Chip
One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)

Group: General Forum Members
Points: 27791 Visits: 13268
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?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
kapil_kk
kapil_kk
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3121 Visits: 2766
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/
Koen Verbeeck
Koen Verbeeck
One Orange Chip
One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)

Group: General Forum Members
Points: 27791 Visits: 13268
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?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
Abu Dina
Abu Dina
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1263 Visits: 3323
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 :-D

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


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
kapil_kk
kapil_kk
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3121 Visits: 2766
Thanks a lot guys.. It worked :-):-D

_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search