SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Import from UTF-8 using OPENROWSET/BULK/FILE FORMA
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mugurel.ilie
Starting Member

1 Posts

Posted - 04/09/2014 :  11:35:04  Show Profile  Reply with Quote
Hello,

I have to import into MS SQL 2012 (without SSIS) some data from csv files which come in UTF-8.
I used the following script using Bulk with format file:
insert into Clients
SELECT * FROM OPENROWSET(BULK 'C:\DbFiles\Clients.CSV',
FORMATFILE='C:\DbFiles\Clients.Xml', firstrow=1, codepage='1250') as t1;

The xml file format is:
<?xml version="1.0"?>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RECORD>
<FIELD ID="1" xsi:type="CharTerm" TERMINATOR="#" MAX_LENGTH="9"/>
<FIELD ID="2" xsi:type="CharTerm" TERMINATOR="#" MAX_LENGTH="28"/>
<FIELD ID="3" xsi:type="CharTerm" TERMINATOR="\r\n" MAX_LENGTH="28" />
</RECORD>
<ROW>
<COLUMN SOURCE="1" NAME="ElemTyp" xsi:type="SQLINT"/>
<COLUMN SOURCE="2" NAME="gvon" xsi:type="SQLNVARCHAR"/>
<COLUMN SOURCE="3" NAME="gbis" xsi:type="SQLNVARCHAR"/>
</ROW>
</BCPFORMAT>

The import went fine but I have some problems with special Romanian characters.

How can I import these special chars even if MS SQL Server doesn't support UTF-8 ?

Thank you !
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.28 seconds. Powered By: Snitz Forums 2000