Link to home
Start Free TrialLog in
Avatar of EddieIT
EddieIT

asked on

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.
ASKER CERTIFIED SOLUTION
Avatar of Deepak Chauhan
Deepak Chauhan
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
EddieIT, do you still need help with this question?