OPENDATASOURCE reading remote database Data Chinese garbled problem-sqlserver R2

Source: Internet
Author: User

Insert INTO Kraft_sync_store (storename,storecode,province,prefecturecity,countycity,region,area,unit,hqka,kaname , Storetype,isvalid,contactperson,mobiletelephone,telephone,address,latitude,longitude,regiongroup, Sfastoremanagername) Select CAST (storename as nvarchar), storecode,province,prefecturecity,countycity,region, Area,unit,hqka,kaname,storetype,isvalid,contactperson,mobiletelephone,telephone,address,latitude,longitude, Regiongroup,sfastoremanagername from OpenDataSource (       ' SQLOLEDB ', ' Data source=10.100.6.114; User Id=ismea; Password=ie1q2w3e4r '    ). WARIS.dbo.I_V_Store

For reading between multilingual versions of databases, it is possible to have garbled Chinese characters. So the above code OPENDATASOURCE read the remote database garbled situation. Should be replaced by the following Linkserver way:

 
CREATE PROCEDURE [dbo]. [Sp_getsyncstore_insert] @storecode nvarchar (+) Asif NOT exists (select name from sys.servers where name = ' SSO ') begin EXE C sp_addlinkedserver ' SSO ', ' ', ' SQLOLEDB ', ' 10.100.6.114 ' exec sp_addlinkedsrvlogin ' SSO ', ' false ', NULL, ' Ismea ', ' ie1q2w3e4r ' Enddelete kraft_sync_store where [Email protected]exec (' INSERT into Kraft_sync_store (StoreName, Storecode,province,prefecturecity,countycity,region,area,unit,hqka,kaname,storetype,isvalid,contactperson, Mobiletelephone,telephone,address,latitude,longitude,regiongroup,sfastoremanagername,storetypegroup, Regiongroupch,createtime) Select Storename,storecode,province,prefecturecity,countycity,region,area,unit,hqka, Kaname,storetype,isvalid,contactperson,mobiletelephone,telephone,address,latitude,longitude,regiongroup, Sfastoremanagername,storetypegroup, "', GETDATE () Createtime from SSO. WARIS.dbo.I_V_Store where storecode= ' [email protected]+ ']; update a set A.REGIONGROUPCH=B.REGIONCODECN from Kraft_sync_stOre aleft join Kraft_regioncodes b on A.regiongroup=b.regioncodeenwhere [email protected]exec sp_dropserver ' SSO ', ' Droplogins ' GO

  

OPENDATASOURCE reading remote database Data Chinese garbled problem-sqlserver R2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.