Reputation: 571
How can i load data records from excel file to mssql database?
Upvotes: 0
Views: 2148
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
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
Reputation: 6122
Upvotes: 0