Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Error While Bulk Insert with UTF-16 encoded file.

Author  Topic 

manojm1979
Starting Member

1 Post

Posted - 2007-03-05 : 04:48:00
Hi friends,

I'm getting the below error when executing the Bulk insert utility with the batch size parameter. If I remove the Batchsize parameter the the bulk insert is going fine. Its failing for what ever value i give for the batch siz e parameter.

Bulk insert data conversion error (truncation) for row 10001

Below decription gives an idea about the file input to the bulk insert.

The BULK INSERT was failing for C.Chinese, Greek and Japanese users. The reason is, we are creating a temporary file for BULK INSERT using the default character encoding, which will corrupt all the data which are in some other encoding. Also, the getBytes() method previously used in writeString()
method will convert the string into bytes in system default encoding scheme. So, modified the code to write the file in UTF-16 encoding as below writer = new BufferedWriter(new OutputStreamWriter(bos, "UTF16"))

so my input file is UTF-16 encoded. Now My bulk insert command has the following parameters set.

sql.append("BULK INSERT CONCUR..")
.append(tbl)
.append(" FROM '")
.append(getPath())
.append("' WITH (")
.append("BATCHSIZE=10000, ")
.append("DATAFILETYPE='widechar',")

.append("FIELDTERMINATOR='")
.append("|\t~")
.append("', ")
.append("ROWTERMINATOR='")
.append(":\\n")
.append("', ")
.append("MAXERRORS=1, ")
.append("CODEPAGE = 850, ")
.append("TABLOCK")
.append(")");

Can any one suggest me the possible reason for this error. Have I given the right value for the CODEPAGE parameter? what value should I give for the CODEPAGE to support UTF-16

Thanks

Manoj
   

- Advertisement -