Using Bulk Copy Program / Linked Server to transfer Excel-VBA file into SQL server

276 Views Asked by At

I have an excel-vba file with about 15000 rows and 4 columns. I need to insert 2 of the columns into Microsoft SQL Management Studio. I have been looking at YouTube tutorials for how to do this but am very new so I got lost.

I have tried to convert my file into a .text file so I could insert it into the SQL server. I also tried to do linked server method but it did not seem to work -- if you have advice on a way to make that work instead, that is welcome as well!

Code in SSMS:

CREATE TABLE ExportTool(TOOLING_SHEET CARCHAR, TOOLS VARCHAR)

INSERT INTO ExportTool VALUES "insert some range here...

SELECT * from ExportTool

** EDITED CODE IN SSMS: **

CREATE TABLE ImportTool(TOOLING_SHEET CARCHAR, TOOLS VARCHAR)

BULK INSERT dbo.ImportTool
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'J:\test-TDS\tools.text');
WITH
    (
    /* insert some range here */
    )

Select * from ImportTool

Using cmd:

DEV.dbo.ExportTool OUT J:\test-TDS\TOOLS.txt -T -c

ENTER: gave the output 0 rows copied

DEV.dbo.ExportTool OUT J:\test-TDS\TOOLS.text -T -c

ENTER: gave the output :

Error = unable to open BCP host data-file

Am I typing something into the cmd incorrectly that it is not copying the files? And how do I alter my code in SSMS to get the information from that file. I cannot find where I am going wrong.

0

There are 0 best solutions below