Table level increament backup

  • Hi Expert,

    How i can take table backup and restore again in sql server when more data is available at the time of import

    create table table2

    (col1 date, col2 char)

    insert into table2

    values('2022-02-02',22)

    then took backup

    at the time of restore found 2 more incremental records in table2

    insert into table2

    values('2022-02-03',22),

    ('2022-02-04',22)

    how it will restore and backup with dates with new records

     

    how it will restore and backup with dates with new records

  • expecting below output

    insert into table2

    values('2022-02-02',22)

    ,('2022-02-03',22),

    ('2022-02-04',22)

  • I don't understand. When you restore from a backup it includes all the data from the backup. SQL Server does not do incremental backups.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Hi Expert,

    i want insert statement from table into file , this will consider as backup

    Expected output

    insert into table2

    values('2022-02-02',22)

    ,('2022-02-03',22),

    ('2022-02-04',22)

  • So you want a process which compares what is in a database table with what is contained in a flat file and which then modifies the flat file to reflect any changes since the process was last run? Sounds like a ton of work for questionable gain – I think I'll let someone else answer.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Shree23 wrote:

    i tried this

    https://www.mytecbits.com/microsoft/sql-server/auto-generate-insert-statements%5B/quote%5D

    And that works. But not incrementally.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Your requirements are not clearly explained.

  • I'd suggest taking a look at Redgate Data Compare. You can run it on a scheduled basis to capture changes to a given data set. You can compare it to a script, a backup, other tables. It should get you where you need to go based on what you're providing.

    However, I am curious what the purpose of this is. Why a secondary data store? Why not simply rely on SQL Server's ability to backup & restore your data?

    Also, disclaimer, I work for Redgate.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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