|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 6:06 AM
Points: 47,
Visits: 266
|
|
Hi, I have 2 database tables. 1) From Production 2) From Dev. The task is to move the data from Production to Dev Server. But the issues is that when the data is already exist then it will update else if no record exist in Dev Server then it will insert.
Existence of Data is checked through one column.
please respond asap if you have any good solution.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Wednesday, June 05, 2013 11:39 AM
Points: 2,679,
Visits: 2,422
|
|
This is pretty straight forward in SSIS
In a dataflow, -create a source from your prod server. -Lookup records on your dev server. In SQL Server 2005 I believe you have to set it to ignore the failure -Create a conditional split that compares the value in your source (prod) to the value you target (dev) -In the split where they match send the data to a staging table -In the split where they don't match send the data to be inserted to your target.
After the data flow runs, build an Execute SQL Task that takes the matched data from your staging table and updated the target (dev) data.
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 6:06 AM
Points: 47,
Visits: 266
|
|
| thanks. its working in some of my test sample data.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Wednesday, June 05, 2013 11:39 AM
Points: 2,679,
Visits: 2,422
|
|
Daniel Bowlin (12/24/2012) This is pretty straight forward in SSIS
In a dataflow, -create a source from your prod server. -Lookup records on your dev server. In SQL Server 2005 I believe you have to set it to ignore the failure -Create a conditional split that compares the value in your source (prod) to the value you target (dev) -In the split where they match send the data to a staging table -In the split where they don't match send the data to be inserted to your target.
After the data flow runs, build an Execute SQL Task that takes the matched data from your staging table and updated the target (dev) data.
A couple of revisions In the no match, that actually would get sent to an update process, not insert There should be a null in some of your lookup values, the nulls would be the new records that should be inserted.
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 6:06 AM
Points: 47,
Visits: 266
|
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, June 13, 2013 8:15 PM
Points: 162,
Visits: 437
|
|
| Since you just want to duplicate the table, you might find it quicker and simpler to just bulk reload the entire table, depending on data volume.
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 3:50 PM
Points: 103,
Visits: 284
|
|
| Have you considered replication? That might be an option.
|
|
|
|