SQL 2005 get data from file -
i have data in simple txt file, trying query (to put in table) when use
select * openrowset('msdasql', 'driver={microsoft text driver (*.txt; *.csv)};defaultdir=c:\db\;extensions=txt;', 'select * data.txt ');
i rows null because (i think) there no field terminator , in utf-16le format, in txt fields know character count, example:
field1field2field3field4field5field6 field1field2field3field4field5field6 field1field2field3field4field5field6 field1field2field3field4field5field6
to make things worse, the file in utf-16le need in utf-8 (or change format within sql 2005) openrowset work
and when use
select * openrowset ( bulk 'c:\db\data.txt', single_nclob) binfile
i data in single row :(
thanks in advance
ps: used sp_addlinkedserver , didnt work
have tried use bulk insert
this?
bulk insert dbo.mytable 'c:\temp\myfile.txt' ( fieldterminator = ',')
Comments
Post a Comment