Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want select data from a txt file like this :
VB
abajijola@yahoo.com
aball_of_fire2003@yahoo.com
abamo_bekhor@yahoo.com
aban_soraty@yahoo.com
aban_star@yahoo.com
aban8_2005@yahoo.com
abanabat@yahoo.com
abas_1jigar@yahoo.com
abas_4567@yahoo.com
abas_abase67@yahoo.com
abas_s_2005@yahoo.com
abas_shakib@yahoo.com
abasalt_tag@yahoo.com
abass_karimi2000@yahoo.com
abatgom@yahoo.com
abb.sea1@yahoo.com

and i whire this code in sql server
SQL
create table #tbl  
(
email nvarchar(50)
)
bulk insert #tbl
from 'C:\Users\user\Desktop\eee\E.txt'
with
(
Rowterminator = '\n'
)
select * from #tbl

but give this error :
Msg 4864, Level 16, State 1, Line 5
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 54667, column 1 (email).
Msg 4864, Level 16, State 1, Line 5
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 54670, column 1 (email).
Msg 4864, Level 16, State 1, Line 5
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 54672, column 1 (email).
Msg 4864, Level 16, State 1, Line 5
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 54674, column 1 (email).
Msg 4864, Level 16, State 1, Line 5
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 54676, column 1 (email).
Msg 4864, Level 16, State 1, Line 5
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 54678, column 1 (email).
Msg 4864, Level 16, State 1, Line 5
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 54680, column 1 (email).
Msg 4864, Level 16, State 1, Line 5
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 55683, column 1 (email).
Msg 4864, Level 16, State 1, Line 5
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 55686, column 1 (email).
Msg 4864, Level 16, State 1, Line 5
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 55688, column 1 (email).
Msg 4864, Level 16, State 1, Line 5
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 55690, column 1 (email).
Msg 4865, Level 16, State 1, Line 5
Cannot bulk load because the maximum number of errors (10) was exceeded.
Msg 7399, Level 16, State 1, Line 5
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 5
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
Posted

1 solution

It's a little devil, isn't it? :laugh:

The "solution" I found: cheat! Use hexadecimal instead of "proper" values :sigh:
SQL
create table #tbl  
(
email nvarchar(50)
)
bulk insert #tbl
from 'C:\Users\user\Desktop\eee\E.txt'
with
(
Rowterminator = '0x0a'
)
select * from #tbl
But be aware that emails can be a lot bigger than 50 chars: the limit is 254 characters...
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900