March 12, 2014 at 1:38 am
Hi Friends,
Please advice me how can I get the expected output from the below Query:
as of now it returns 1 of two columns whereas I need the both 2 column's output. kindly suggest me.
Code:
---------------------------------------------------------------------
DECLARE @hdoc int
DECLARE @doc varchar(1000)
SET @doc = '
<MasterData>
<Data>
<id>1</id>
<ApprovalId>1</ApprovalId>
</Data>
<Data>
<id>12</id>
<ApprovalId>2</ApprovalId>
</Data>
<Data>
<id>31</id>
<ApprovalId>1</ApprovalId>
</Data>
</MasterData>'
exec sp_xml_preparedocument @hdoc output, @doc
select *
from openxml(@hdoc,'/MasterData/Data',2)
with (Id int, ApprovalId int)
exec sp_xml_removedocument @hdoc
---------------------------------------------------------------------
all your valued suggestions are appreciated sincerely...
Thanks in Advance
Prabhu
March 12, 2014 at 3:31 am
Change this from
with (Id int, ApprovalId int)
To
with (id int, ApprovalId int)
its case sensitive 😉
March 12, 2014 at 3:35 am
yahoo... !!!
its rocking.. thanks man.. working fine..
Thanks,
Prabhu
March 12, 2014 at 3:41 am
glad to help you 🙂
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply