
-- Insert the original data
CREATE TABLE [dbo].[R1] (
[tid] int NOT NULL,
[str] varchar (80) NOT NULL,
PRIMARY KEY   (tid)
)
GO
CREATE TABLE [dbo].[R2] (
[tid] int NOT NULL,
[str] varchar (80) NOT NULL,
PRIMARY KEY   (tid)
)
GO

-- Assume tab-separated files with field names on the first row.
-- The rows should have format <sid>\t<string>
BULK INSERT [dbo].[R1] FROM 'R1.txt'
WITH (
   DATAFILETYPE = 'char',
   FIELDTERMINATOR = '\t',
   ROWTERMINATOR = '\n',
   FIRSTROW = 2
)
GO
BULK INSERT [dbo].[R2] FROM 'R2.txt'
WITH (
   DATAFILETYPE = 'char',
   FIELDTERMINATOR = '\t',
   ROWTERMINATOR = '\n',
   FIRSTROW = 2
)
GO
