Wednesday 4 June 2014

Copy data from one mysql server to another using SSIS

create a user in mysql

CREATE USER 'admin'@'%' IDENTIFIED BY '@dm1n';
GRANT ALL TO 'admin'@'%'
FLUSH PRIVILEGES;

Create 3 Variables MaxID ,MinID and Variable


















Now add for loop,execute sql task and DFT




In Data flow task Define the source connection and Destination Connection.Use ADO.Net Connection managers for both.

In For Loop Type the number of times you want your loop to execute





















 In First Execute SQL task editor add the destination connection and Insert this in SQL Command

 set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,ANSI_QUOTES'


In Second execute SQL task set the properties as



 
 Right click the data flow task and go to properties ->expressions ->ADO NET Source 1 command

"SELECT  EventLogID, ApiKey, ApiToken, UserID, EventDate, EventTypeID, EventCategoryID, Message, Data, CreatedDate, UpdatedDate FROM  ka_eventlog
   WHERE     EventLogID between '"+ (DT_WSTR,15) @[User::minid]+"'  AND '"+ (DT_WSTR,15) @[User::maxid]+"'"


Connect to destination Connection

Make sure you set your connection manager's properties by right clicking them and setting as

 Retain Same connection true
and
Delay Validation true





No comments:

Post a Comment