Friday 13 September 2013

Dynamically mapping source and destination table and column information and load from souce to destination,how to use Microsoft.SqlServer.TableTransferGeneratorTask

To achieve this task (Dynamically map source and destination table in XML file) we can use the task Microsoft.SqlServer.TableTransferGeneratorTask

  1. I am going to load the table data from source server to destination server without creating dataflow task in ssis package
  2. all table, column mapping I am going to configured in XML file like
    •  source table name and destination table name
    •  source column name and destination column name
    •  column length
    • column data type
  3. I am going to use Microsoft.SqlServer.TableTransferGeneratorTask  to achieve this task(Its       Microsoft task)
  4. Please execute this script in any sql server database server
create database dbSource
go
create database dbDestination
go
use dbSource
go
Create Table Test(emp_id int)
go
insert into Test values (10)
insert into Test values (20)
insert into Test values (30)
go
Create table SourceSoaps (sSoapName varchar(20),sSoapCost decimal(15,4))
go
insert into SourceSoaps values('santoor',20.02)
insert into SourceSoaps values('mysoresand',50.23)
insert into SourceSoaps values('deve',852.02)
go
use dbDestination
go
Create Table Test(emp_id int)
go
Create table DestinationSoaps (dSoapName varchar(20),dSoapCost decimal(15,4))