Export (0) Print
Expand All

Step 2: Create a Bidirectional Schema

SQL Server 2000

To create a bidirectional schema, create a table with the same schema in each test database and populate it with sample data.

Examples
1. Create a table in test1 and populate with 10 rows
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
)
GO

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
2. Create a table in test2 and populate with 10 rows
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
Show:
© 2014 Microsoft