Bulk Insert Of Long Unicode Strings
Jul 20, 2005
Here is the situation, please let me know if you have any tips:
..TXT files in a share at \foo
SPROCS run daily parses of many things, including data on that share. The
other day, we encountered rows in the TXT files which looked like:
column1Row1data,column2Row1data
column1Row2data,column2Row2data
...etc..
However, column2 was about 6000 bytes of unicode. We are bulk inserting
into a table specifying nvarchar(4000). When it encounters high unicode
rows, it throws a truncation error (16).
We really need information contained in the first 200 bytes of the string in
column2. However, the errors are causing the calling SPROC to abort.
Please let me know if you have any suggestions on workarounds for this
situation. Ideally, we would only Bulk Insert a sub-section of column2 if
possible.
Thanks!
/Ty
View 2 Replies
Jul 14, 2004
I could not insert Unicode strings into SQL Server 2000 DB by using OleDbAdapter (insert into command), e.g: "á à u".
Please give me an instruction.
Thank you.
View 3 Replies
View Related
Feb 27, 2008
I have been racking my brain over this hopefully someone has run into a similar issue. I am attempting to Bulk insert several Unicode (UCS-16BE) data files that are missing their Unicode Signature. If I add a Big-Endian signature (FE FF) I can get the files to load into a table without using a format file, but if I attempt to use a format file I get the following error ( I need to use a format file due to more columns in the actual table than in the file):
Msg 4832, Level 16, State 1, Line 1
Bulk load: An unexpected end of file was encountered in the data file.
Msg 7399, Level 16, State 1, Line 1
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 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
If I attempt to load without the Unicode signature, with a format file the correct number of characters load into the fields, but the data is all €˜€™s. I have tried various codepages (including 1201 & 1200) and codepage settings and none have any effect on the data that is loaded or not loaded.
Code Using Format File:
BULK INSERT [ARE_Test_Stage].[dbo].LFBK
FROM 'U:ProjectsTempUnicodeTest2 est-w.TXT'
WITH (
DATAFILETYPE = 'widechar',
CODEPAGE = '1201',
MAXERRORS = 2147000000,
FORMATFILE = 'U:ProjectsTempUnicodeTest2FormatFiles est-w_METADATA.fmt',
KEEPNULLS
)
Format File:
9.0
14
1 SQLNCHAR 0 6 "