日期:2014-05-17  浏览次数:20391 次

读取xml乱码
DECLARE @FileName varchar(255)
DECLARE @ExecCmd VARCHAR(255)
DECLARE @y INT
DECLARE @x INT
DECLARE @FileContents VARCHAR(8000)
CREATE TABLE #tempXML(PK INT NOT NULL IDENTITY(1,1), ThisLine NVARCHAR(255))
SET @FileName = 'F:\XML\SysSet009.xml'
SET @ExecCmd = 'type ' + @FileName
SET @FileContents = ''
INSERT INTO #tempXML (ThisLine ) EXEC master.dbo.xp_cmdshell @ExecCmd 
select *from #tempXML

读取中文乱码?怎么处理

------解决方案--------------------
declare @doc xml;

set @doc = (select doc from openrowset(bulk 'F:\XML\SysSet009.xml',single_blob) as t(doc))
print(convert(varchar(max),@doc))