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

Need to copy data for a period of time. Expand / Collapse
Author
Message
Posted Wednesday, January 30, 2013 9:17 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, April 17, 2013 3:10 AM
Points: 17, Visits: 105
Hi,

I need to copy data from PROD to QA between 29th Jan 6am and 10am for few tables. The Tables are replicated (transactional). How can I do it?
Post #1413679
Posted Wednesday, January 30, 2013 10:45 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, February 15, 2013 1:38 PM
Points: 3, Visits: 77
If the databases are linked, and the data is NOT in the target then just use an insert:
INSERT INTO QA.dbo.table1 
SELECT * FROM PROD.dbo.table1 WHERE CDate BETWEEN '1/10/2012 6:00' AND '1/10/2012 10:00'

Post #1413714
Posted Wednesday, January 30, 2013 11:29 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, May 08, 2013 10:24 AM
Points: 237, Visits: 413
If the servers are linked, and assuming you do not want to restart the replication, then I would recommend using the MERGE command to INSERT, UPDATE and or DELETE based on the primary key and whatever other fields you need to identify IF and WHAT the replication has not copied the records for some reason. Without knowing the nature of the data, we cannot assume its an insert, there may be updates and deletes to take care of as well.
Post #1413729
Posted Thursday, January 31, 2013 3:58 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, April 17, 2013 3:10 AM
Points: 17, Visits: 105
CDate column is no there in the tables. What shall I do?
Post #1413975
Posted Thursday, January 31, 2013 4:43 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, February 15, 2013 1:38 PM
Points: 3, Visits: 77
Is there no way to tell when a record was added?

Are you trying to keep two tables in sync? If so look into replication.
Post #1413992
Posted Thursday, January 31, 2013 4:52 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, April 17, 2013 3:10 AM
Points: 17, Visits: 105
No, the tables are not in sync.
Didn't find any columns that specify the time on the tables..
Post #1413998
Posted Thursday, January 31, 2013 7:31 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Yesterday @ 4:17 PM
Points: 345, Visits: 1,323
What are you trying to accomplish?

http://thesqlguy.blogspot.com/
Post #1414142
Posted Thursday, January 31, 2013 8:54 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, April 17, 2013 3:10 AM
Points: 17, Visits: 105
This is actually from one of our client.

As mentioned he needs the data for that time period. Means copying the data from PROD to QA.

I just want to know is it possible to do if not I will just copy the whole db.
Post #1414184
Posted Thursday, January 31, 2013 9:18 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 7:50 AM
Points: 8,595, Visits: 8,235
surilds (1/31/2013)
This is actually from one of our client.

As mentioned he needs the data for that time period. Means copying the data from PROD to QA.

I just want to know is it possible to do if not I will just copy the whole db.


It might be possible but you have not provided anywhere near enough information. You might be able to do a point in time restore to get your database as it appeared at a given point in time. You might be able to copy certain rows if there is a way to identify what rows need to be copied. It seems like a restore from prod to QA might be ok too.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1414210
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse