The XML parse error 0xc00ce556 occurred on line number 1
-
Good Day all I have an SP that is defined like this
ALTER PROCEDURE [dbo].[sp_Constraints_Update] @xml ntext,
@TTBLType varchar(5)AS
set nocount on
DECLARE @xmldoc int
DECLARE @sql varchar(8000)-- In one long sql string do all of the following
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @xmldoc OUTPUT, @xmlif exists (select * from [tempdb].[dbo].sysobjects where id = object_id(N'[tempdb].[dbo].[#Constraints]'))
drop table [#Constraints]-- turn the xml into a table with characteristics of the given table
SELECT *
INTO #Constraints
FROM OPENXML ( @xmldoc , '/Root/Row' , 2)
WITH (
[ID] int, -- ID of the activitiy or contact (XM) to update
DayOp char(7) 'Day_Action',
[Day] int 'Day',
SessOp char(7) 'Period_Action',
Sess int 'Period')
EXEC sp_xml_removedocument @xmldoc
--select * from #Constraints
update #Constraints set [Day] = null where [Day] = 0 -- can't have [Day] <, = or > 0
update #Constraints set [Sess] = null where [Sess] = 0 -- can't have [Day] <, = or > 0-- todo make this generic for class or exam
update tbl_actv
set [Day] = #Constraints.[Day],
DayOp = case(#Constraints.[DayOp])
when 'on' then '='
when 'before' then '<'
when 'after' then '>'
end,
Session = #Constraints.Sess,
SessOp = case(#Constraints.[SessOp])
when 'on' then '='
when 'before' then '<'
when 'after' then '>'
end
from #Constraints
where #Constraints.ID = tbl_actv.IDand i have have tried to execute it like this
exec sp_Constraints_Update 'EXAM','<Root><Row><ID>3</ID><Activity>ACC121 T1 [1]</Activity><Day_Action>on</Day_Action><Day>15</Day><Period_Action>on</Period_Action><Period>15</Period></Row><Row><ID>9</ID><Activity>ADM121 T1 [1]</Activity><Day_Action>on</Day_Action><Day>4</Day><Period_Action>on</Period_Action><Period>4</Period></Row><Row><ID>13</ID><Activity>ADM122 T1 [1]</Activity><Day_Action>on</Day_Action><Day>1</Day><Period_Action>on</Period_Action><Period>7</Period>&l
-
Good Day all I have an SP that is defined like this
ALTER PROCEDURE [dbo].[sp_Constraints_Update] @xml ntext,
@TTBLType varchar(5)AS
set nocount on
DECLARE @xmldoc int
DECLARE @sql varchar(8000)-- In one long sql string do all of the following
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @xmldoc OUTPUT, @xmlif exists (select * from [tempdb].[dbo].sysobjects where id = object_id(N'[tempdb].[dbo].[#Constraints]'))
drop table [#Constraints]-- turn the xml into a table with characteristics of the given table
SELECT *
INTO #Constraints
FROM OPENXML ( @xmldoc , '/Root/Row' , 2)
WITH (
[ID] int, -- ID of the activitiy or contact (XM) to update
DayOp char(7) 'Day_Action',
[Day] int 'Day',
SessOp char(7) 'Period_Action',
Sess int 'Period')
EXEC sp_xml_removedocument @xmldoc
--select * from #Constraints
update #Constraints set [Day] = null where [Day] = 0 -- can't have [Day] <, = or > 0
update #Constraints set [Sess] = null where [Sess] = 0 -- can't have [Day] <, = or > 0-- todo make this generic for class or exam
update tbl_actv
set [Day] = #Constraints.[Day],
DayOp = case(#Constraints.[DayOp])
when 'on' then '='
when 'before' then '<'
when 'after' then '>'
end,
Session = #Constraints.Sess,
SessOp = case(#Constraints.[SessOp])
when 'on' then '='
when 'before' then '<'
when 'after' then '>'
end
from #Constraints
where #Constraints.ID = tbl_actv.IDand i have have tried to execute it like this
exec sp_Constraints_Update 'EXAM','<Root><Row><ID>3</ID><Activity>ACC121 T1 [1]</Activity><Day_Action>on</Day_Action><Day>15</Day><Period_Action>on</Period_Action><Period>15</Period></Row><Row><ID>9</ID><Activity>ADM121 T1 [1]</Activity><Day_Action>on</Day_Action><Day>4</Day><Period_Action>on</Period_Action><Period>4</Period></Row><Row><ID>13</ID><Activity>ADM122 T1 [1]</Activity><Day_Action>on</Day_Action><Day>1</Day><Period_Action>on</Period_Action><Period>7</Period>&l
I might be missing something but you appear to have your parameters the wrong way around, 'EXAM' should be after the XML string not before.
-
I might be missing something but you appear to have your parameters the wrong way around, 'EXAM' should be after the XML string not before.
Am Sorry its one of the days. Thanks its working :)
Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.somee.com http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/