BULK INSERT using format file and dat file

时间:2019-04-08 13:33:33

标签: sql-server

I generated a dat file with a format file in SQL 2014, now I'm trying to use a BULK INSERT but I receive this error:

The OLE DB provider "BULK" for linked server "(null)" supplied invalid metadata for column "CallTime". The datatype required a precision, but none was supplied.

The column is defined as string like this:

[CallTime] sparse nvarchar(20) null

The call is like this:

BULK INSERT [invc].[MyTable]
FROM 'D:\Temp\file.dat'
WITH 
  (
    FORMATFILE = 'D:\Temp\format.fmt'
    ,KEEPNULLS
  );

My format file looks like this (I know I have more columns defined):

enter image description here

The values on that columns looks like this:

22:26

Not sure why I'm getting this error, besides, the table is a big table with millions of records, what's the best way to generate the file, dat or text?

0 个答案:

没有答案