日期:2014-05-18  浏览次数:20877 次

SQL 跨服务乱码
CREATE TABLE #temp (

tt nvarchar(15) COLLATE SQL_Latin1_General_CP1_CI_AS,
aa nvarchar(20) COLLATE SQL_Latin1_General_CP1_CI_AS



insert into #temp 
select ) name ,[classtype_work] from (
SELECT 
  name = cast(name COLLATE SQL_Latin1_General_CP1_CI_AS as nvarchar(15)) 
  ,[classtype_work]=cast(classtype_work COLLATE SQL_Latin1_General_CP1_CI_AS as nvarchar(20)) 
   
  FROM OPENDATASOURCE('SQLOLEDB','Data Source=192.168.1.205,1433;User ID=sa;Password=123456').[wilsonhr].[dbo].[kq_datereport]
 
 )a
 select * from #temp
 drop table #temp 

插入临时表时,出现乱码 而在查询时,正常

------解决方案--------------------