Step 2: Create a Bidirectional Schema

To create a bidirectional schema:

  1. Enable the replication databases.
  2. Create two-way tables and populate with rows.
Examples
A. Enable the replication databases

USE master

GO

EXEC sp_replicationdboption N'test1', N'publish', false

GO

EXEC sp_replicationdboption N'test2', N'publish', false

GO

EXEC sp_replicationdboption N'test1', N'publish', true

GO

EXEC sp_replicationdboption N'test2', N'publish', true

GO

  

B. Create a two-way table and populate with 10 rows in test1

USE test1

GO

IF EXISTS (SELECT * FROM sysobjects WHERE name LIKE 'two_way_test1')

    DROP TABLE two_way_test1

GO

  

CREATE TABLE two_way_test1

(pkcol int primary key not null,

 intcol int,

 charcol char(100),

 datecol datetime

)

INSERT INTO two_way_test1 VALUES (1, 10, 'row1', GETDATE())

INSERT INTO two_way_test1 VALUES (2, 20, 'row2', GETDATE())

INSERT INTO two_way_test1 VALUES (3, 30, 'row3', GETDATE())

INSERT INTO two_way_test1 VALUES (4, 40, 'row4', GETDATE())

INSERT INTO two_way_test1 VALUES (5, 50, 'row5', GETDATE())

INSERT INTO two_way_test1 VALUES (6, 60, 'row6', GETDATE())

INSERT INTO two_way_test1 VALUES (7, 70, 'row7', GETDATE())

INSERT INTO two_way_test1 VALUES (8, 80, 'row8', GETDATE())

INSERT INTO two_way_test1 VALUES (9, 90, 'row9', GETDATE())

INSERT INTO two_way_test1 VALUES (10, 100, 'row10', GETDATE())

GO

  

C. Create a two-way table and populate with 10 rows in test2

USE test2

GO

  

IF EXISTS (SELECT * FROM sysobjects WHERE name LIKE 'two_way_test2')

    DROP TABLE two_way_test2

GO

  

CREATE TABLE two_way_test2

(pkcol int primary key not null,

 intcol int,

 charcol char(100),

 datecol datetime

)

GO

  

INSERT INTO two_way_test2 VALUES (1, 10, 'row1', GETDATE())

INSERT INTO two_way_test2 VALUES (2, 20, 'row2', GETDATE())

INSERT INTO two_way_test2 VALUES (3, 30, 'row3', GETDATE())

INSERT INTO two_way_test2 VALUES (4, 40, 'row4', GETDATE())

INSERT INTO two_way_test2 VALUES (5, 50, 'row5', GETDATE())

INSERT INTO two_way_test2 VALUES (6, 60, 'row6', GETDATE())

INSERT INTO two_way_test2 VALUES (7, 70, 'row7', GETDATE())

INSERT INTO two_way_test2 VALUES (8, 80, 'row8', GETDATE())

INSERT INTO two_way_test2 VALUES (9, 90, 'row9', GETDATE())

INSERT INTO two_way_test2 VALUES (10, 100, 'row10', GETDATE())

GO

  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.