Cannot fetch a row from OLE DB provider “BULK” for linked server “(null)”

前端 未结 12 1549
粉色の甜心
粉色の甜心 2021-02-18 13:24

I try to load my database with tons of data from a .csv file sized 1.4 GB. But when I try to run my code I get errors.

Here\'s my code:

USE [Intradata N         


        
12条回答
  •  野性不改
    2021-02-18 13:38

    This might be a bad idea with a full 1.5GB, but you can try it on a subset (start with a few rows):

    CREATE TABLE CSVTest1
    (Ticker varchar(MAX) NULL,
        dateval varchar(MAX) NULL,
        timevale varchar(MAX) NULL,
        Openval varchar(MAX) NULL,
        Highval varchar(MAX) NULL,
        Lowval varchar(MAX) NULL,
        Closeval varchar(MAX) NULL,
        Volume varchar(MAX) NULL
    )
    

    ... do your BULK INSERT, then

    SELECT MAX(LEN(Ticker)),
        MAX(LEN(dateval)),
        MAX(LEN(timevale)),
        MAX(LEN(Openval)),
        MAX(LEN(Highval)),
        MAX(LEN(Lowval)),
        MAX(LEN(Closeval)),
        MAX(LEN(Volume))
    

    This will help tell you if your estimates of column are way off. You might also find your columns are out of order, or the BULK INSERT might still fail for some other reason.

提交回复
热议问题