Need to copy data for a period of time.

  • 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?

  • 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'

  • 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.

  • CDate column is no there in the tables. What shall I do?

  • 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.

  • No, the tables are not in sync.

    Didn't find any columns that specify the time on the tables..

  • What are you trying to accomplish?

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • 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.

  • 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 Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply