Issue Exporting Chinese characters using sp_OAMethod

Hello Experts, I have a stored procedure exporting pipe delimited files using    
"EXECUTE @hr = sp_OAMethod   @objFileSystem , 'OpenTextFile' , @objTextStream OUT , @FileAndPath,8,true"
The fields are declares as nvarchar(max), but data is not exporting. When I declare fields as VARCHAR, the data exports, however the Chinese characters come out as "?????"


Please let me know if you have a solution to the issue.
EddieITAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Deepak ChauhanSQL Server DBACommented:
Change the column type to Nvarchar and add N' before string.

eg
INSERT INTO Table (Field1) VALUES (N'any chinese character')

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
David Johnson, CD, MVPOwnerCommented:
which collation is your sql server set to?  as mentioned above the unicode characters are probably being dropped.  also ensure that you have the correct language support added to the operating system.
use tempdb
go
create table zhongwen(mingzi nvarchar(10))
go
insert into zhongwen values (N'有方')
insert into zhongwen values (N'李杰')
insert into zhongwen values (N'空炮鸡蛋')
go
select * from zhongwen

go
create procedure zhongwenfind 
 (@mingzi nvarchar(10))
 AS
 SELECT mingzi FROM zhongwen 
 WHERE mingzi  = @mingzi  
go
exec zhongwenfind N'李杰'
go
drop table zhongwen
go
drop procedure zhongwenfind
go

Open in new window

However, if you try to pass a Chinese literal as '李杰' instead of N'李杰' it will turn into '??'.
http://bit.ly/1h4A0jT
Vitor MontalvãoMSSQL Senior EngineerCommented:
EddieIT, do you still need help with this question?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.