How can I upload data from a flat file (excel) to SQL server express?

1

I tried to upload a flat file (excel) in xlsx and csv formats but I get the following error:

  

Mens. 4864, Level 16, State 1, Line 1 Data conversion error   of mass loading (type not matching or character not valid for the   code page specified) in row 1, column 1 (IDFacture).

The invoice id is fine since it is a numeric field starting from 2 since there is a registered data.

I already did a test on a type of txt file and it worked perfectly but all the data is in excel I can do in that case.

I also tried it through the sql server support tool but it did not allow me to upload it.

BULK

INSERT factura
FROM 'D:\Datos\DatosE.csv'
WITH

( FIELDTERMINATOR = ',', 
  ROWTERMINATOR = '\n' ) 

GO

this is the corresponding table

 create table factura(

 IdFactura int not null PRIMARY KEY,
 NumeroFactura varchar(30) not null,
 CedulaCliente varchar(15) not null,
 Direccion varchar(20) not null,
 Direccion2 varchar(20) not null,
 Departamento varchar(20),
 Ciudad varchar(20),
 Barrio varchar(20),
 Subtotal numeric(10,2) not null,
 iva numeric(10,2) not null,
 CargoExtras numeric(10,2) not null,
 Total numeric(10,2) not null,
 fecha date,
 ClienteID int,
 PedidoID int,

 );

and then an example of the data to pass

       3,   125,    87654321,   cra 24 # 34 13, 0,  bolivar,    cartagena,  
       San_Antonio, 1008403.36, 191596.64,  50000,  1250000,    2017-05-02, 2,  3
    
asked by freb r 09.10.2017 в 15:35
source

0 answers