Home Forums SQL Server 2005 SS2K5 Replication add article to replication without snapshotting entire DB. RE: add article to replication without snapshotting entire DB.

  • it's really very easy .. here's an example for sql2k adding a table to transactional replication:-

    --

    -- add table to publication

    --

    exec dbo.sp_addarticle 'mypublication' ,@article='mytable',@source_table='mytable',@destination_table='mytable',

    @force_invalidate_snapshot=1

    go

    --

    -- refresh the subscription

    --

    exec dbo.sp_refreshsubscriptions  'mypublication'

    go

    --

    --

    -- now run the snapshot agent which will only update the object changed/ added new object

    --

    exec msdb.dbo.sp_start_job @job_name='xxxx 'mypublication'

    go

    --

    get the name of  'mypublication'

     --

    -- execute within the published database e.g. the database being replicated

    -- to obtain the publication name

    --

    exec dbo.sp_helppublication

    go

     

     

     

    [font="Comic Sans MS"]The GrumpyOldDBA[/font]
    www.grumpyolddba.co.uk
    http://sqlblogcasts.com/blogs/grumpyolddba/