ncvo / charity-commission-extract

Python utilities for handling the import of data from the Charity Commission data extract
43 stars 21 forks source link

MS SQL Server import #7

Closed flagmanchris closed 5 years ago

flagmanchris commented 5 years ago

I've just imported these files into a MS SQL Server database and I thought it may be useful to share the command I used to do this (after creating the tables using the provided SQL scripts)

The bcp files need to be accessible to the server (either copied locally or using a UNC path to a network location). For each of the files, run the below, replacing the table and filenames:

BULK INSERT dbo.extract_acct_submit
FROM 'c:\RegPlusExtract\extract_acct_submit.bcp' 
WITH 
(
  FIELDTERMINATOR ='@**@', 
  ROWTERMINATOR = '*@@*'
)
marc-ncvo commented 5 years ago

Thanks @flagmanchris! Yes, this will be useful for those wishing to import the exported BCP files back into a MS SQL Server database.