473,387 Members | 3,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

BULK INSERT FROM UTF-8 FILE

Hi there,

I have some text files saved using a UTF-8 encoding. The "BULK INSERT"
statment in Sql Server 2000 is failing with a column length error. Saving
the file as ASCII removes the problem. However, I would like to import files
in UTF-8 format. I understand that the BCP tool, when used from the command
line, can take an "-F UTF8" argument, which allows it to work. Can this be
done from the SQL> prompt with the BULK INSERT statement?

Cheers,

Tobin
Jul 20 '05 #1
2 13694

"Tobes (Breath)" <to****************@breathemail.net> wrote in message
news:bp*************@ID-131901.news.uni-berlin.de...
Hi there,

I have some text files saved using a UTF-8 encoding. The "BULK INSERT"
statment in Sql Server 2000 is failing with a column length error. Saving
the file as ASCII removes the problem. However, I would like to import files in UTF-8 format. I understand that the BCP tool, when used from the command line, can take an "-F UTF8" argument, which allows it to work. Can this be
done from the SQL> prompt with the BULK INSERT statement?

Cheers,

Tobin


I believe that the -F argument is for the Sybase version of BCP. The closest
equivalent in MSSQL is probably -w, but it may not be functionally
equivalent. Using BULK INSERT, that would be "DATAFILETYPE = 'widechar'".

Simon
Jul 20 '05 #2
"Simon Hayes" <sq*@hayes.ch> wrote in message
news:3f**********@news.bluewin.ch...
I believe that the -F argument is for the Sybase version of BCP. The closest equivalent in MSSQL is probably -w, but it may not be functionally
equivalent. Using BULK INSERT, that would be "DATAFILETYPE = 'widechar'".


Thanks for the response, Simon. Ah, I see, I must have found a Sybase
example for the -F argument! I actually discovered the 'widechar' thing in
the docs, but for some reason it was still falling over on the last column
of the first row. I tried the other options such as 'RAW' etc but with no
luck!

Currently I'm asking the developer to output the file as ASCII or ANSI, so
that should be solved (although it would be nice if the BULK INSERT
accommodated such variations). However, the files are gonna be UNIX files,
so my next trick is to have BCP understand how to read these!

Tobin
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris | last post by:
Any help would be appreciated. I am running a script that does the following in succession. 1-Drop existing database and create new database 2-Defines tables, stored procedures and functions...
2
by: David Sharp | last post by:
I've been doing some experiments with speeding up copying tables of approximately 1 million rows between databases using BCP and BULK INSERT. I noticed that the total time for removing the...
2
by: php newbie | last post by:
Hello, I am trying to load a simple tab-delimited data file to SQL Server. I created a format file to go with it, since the data file differs from the destination table in number of columns. ...
7
by: iqbal | last post by:
Hi all, We have an application through which we are bulk inserting rows into a view. The definition of the view is such that it selects columns from a table on a remote server. I have added the...
2
by: Niraj | last post by:
Hi, I am trying to do bulk insert of binary data (array of bytes) in an Oracle table. The data type of the table is BLOB. I am using Oracle Objects for OLE (OO4O) in C++. The binary data that I...
1
by: Metal Dave | last post by:
I do not understand the error handling of SQL Server here. Any error in bulk insert seems to halt the current T-SQL statement entirely, rendering it impossible to log an error. The first statement...
2
by: Weyus | last post by:
All, Just want to make sure that I understand what's going on here. I have a table with IGNORE_DUP_KEY set on a unique, multi-column index. What I'm seeing is this: 1) When performing a...
4
by: souravmallik | last post by:
Hello, Is there any way to improve performance of an after insert trigger in bulk insert. I have a pro*c program that insert data in a stagging table in bulk insert mode. From stagging table I...
0
by: bob laughland | last post by:
Hi All, I am using a combination of LINQ to SQL and bulk insert. In the process of performing 'one unit of work' I will be doing things like reading, and deleting records using LINQ to SQL and...
3
by: bob laughland | last post by:
Hi All, I am using a combination of LINQ to SQL and bulk insert. In the process of performing 'one unit of work' I will be doing things like reading, and deleting records using LINQ to SQL and...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.