ramezani.saleh
ramezani.saleh

Reputation: 571

Load data records from EXCEL to mssql database

How can i load data records from excel file to mssql database?

Upvotes: 0

Views: 2148

Answers (3)

ramezani.saleh
ramezani.saleh

Reputation: 571

csv files are in ascii format and have some problem with unicode characters such as 'ی' – ramezani.saleh 26 mins ago For this problem i must export my excel file to Unicode text file and then i must use

BULK INSERT tablename FROM 'C:\Temp\filename.txt' WITH ( FIRSTROW
= 2, MAXERRORS = 0, FIELDTERMINATOR = '\t', ROWTERMINATOR = '\n'  )

I thinks it works and the problem of csv files with unicode charcters will solve (such as 'ی')

Upvotes: 1

nimizen
nimizen

Reputation: 3429

Provided your data types are consistent between the CSV columns and your database columns then a bulk insert would work.

BULK INSERT tablename
FROM 'C:\Temp\filename.csv'
WITH
(
FIRSTROW = 2,
MAXERRORS = 0,
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n' 
)

Upvotes: 1

das_weezul
das_weezul

Reputation: 6122

Upvotes: 0

Related Questions