April 15, 2008 at 10:46 pm
i have stored proc like this
create proc sp_translate_simple_xml(@XMLfile varchar(100))
as
BEGIN
declare @idoc int
declare @doc varchar(8000)
declare @xml_line varchar(200)
declare @bulkinscmd varchar(500) set @doc =''
Create table #tempXML(line varchar(8000))
set @bulkinscmd = 'BULK INSERT #tempXML FROM ' + '''' + @XMLfile + ''''
exec (@bulkinscmd)
DECLARE xml_cursor CURSOR FOR SELECT * FROM #tempXML
OPEN xml_cursor
FETCH NEXT FROM xml_cursor INTO @xml_line
WHILE @@FETCH_STATUS = 0
BEGIN
SET @doc = @doc + rtrim(ltrim(@xml_line))
FETCH NEXT FROM xml_cursor INTO @xml_line
END
close xml_cursor
deallocate xml_cursor
drop table #tempXML
exec sp_xml_preparedocument @idoc OUTPUT, @doc
SELECT text
FROM OPENXML (@idoc, '/ROOT/LINE')
WHERE text is not null
EXEC sp_xml_removedocument @idoc
END
when i exec this with sp name
i am getting the error like this
(7082 row(s) affected)
The XML parse error 0xc00ce55e occurred on line number 1, near the XML Msg 6602, Level 16, State 2, Procedure sp_xml_preparedocument, Line 1
The error description is 'Element was not closed.'.
Msg 8179, Level 16, State 5, Procedure sp_translate_simple_xml, Line 22
Could not find prepared statement with handle 0.
Msg 6607, Level 16, State 3, Procedure sp_xml_removedocument, Line 1
sp_xml_removedocument: The value supplied for parameter number 1 is invalid.
August 27, 2008 at 3:05 am
xml element is not closed. Try making your varchar(100) something bigger
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply