Home > front end >  Bulk insert gives 0 rows affected
Bulk insert gives 0 rows affected

Time:12-25

The following SQL statement returns "0 rows affected".

The update table is created and the bulk insert is executed without errors. The file I am trying to import is a ; separated with the headers on the first row. Every row is on a new line.

I have tried several changes but I keep getting the same message on and on:

CREATE TABLE DW2.dbo.UPD_TANKINGEN_XXX 
(
    datum NVARCHAR(50),
    tijd NVARCHAR(50),
    kaart NVARCHAR(50),
    kenteken NVARCHAR(50),
    chauffeur NVARCHAR(50),
    bon NVARCHAR(50),
    km_st NVARCHAR(50),
    stationsnaam NVARCHAR(50),
    productnaam NVARCHAR(50),
    volume NVARCHAR(50),
    netto_bedrag_excl_btw NVARCHAR(50),
    factuurnr NVARCHAR(50),
    Debiteurnummer NVARCHAR(50)
)
GO

BULK INSERT DW2.dbo.UPD_TANKINGEN_XXX
FROM 'K:\_DWH\_DW2\Tankdata\XXX.csv' 
WITH (FIRSTROW=2, FIELDTERMINATOR=';', ROWTERMINATOR='\n\r', keepnulls)
GO

CodePudding user response:

The problem usually is that UTF-8 is not supported by default. You can try converting this to UTF-16 (Unicode).

You can use a command line utility for this or just open Notepad > EOL conversion in Edit > Choose Windows Format

  • Related