Tuesday, June 23, 2020

SQL SERVER - How to load data from text file to table ?

If I have this table:
column_name     datatype   length
--------------- ---------- ------
id              varchar    7
description     nvarchar   60
last_index      int        NULL
..and this text file (first three rows only here):
-00000;přídavné podstavce;15
-01881;hřídel, nástavec-spojovací(keiper);145
For import file data to this table use this statement:
delete dbo.drawing_index;

bulk insert dbo.drawing_index
from 'c:\cieb\import\drawing_index.txt'
	CODEPAGE = '65001',	-- UTF-8
	fieldterminator = ';',

No comments:

Post a Comment