Reputation: 2473
Do I store this XML file data into a SQL XML datatype field?
How do I write to it without writing into a XML file?
Upvotes: 1
Views: 262
Reputation: 28596
If you want to store in SQL Server better use the XML data type as you get advantage of checking the type with XSD schema.
Upvotes: 0
Reputation:
Its not clear to me what you want. But you can store the xml file into a xml field and manipulate this field whatever you want.
Oracle database allows you to create a table based on a xml file, and changes on the table reflect over the xml file, you cant do that in SQL Server.
Anyway, you can manipulate a xml field like this:
declare @friends xml
set @friends =
'
<friends>
<friend>
<id>3</id>
</friend>
<friend>
<id>6</id>
</friend>
<friend>
<id>15</id>
</friend>
</friends>
'
select
template.item.value('.', 'bigint') as id
from @friends.nodes('//friends/friend/id') template(item)
Upvotes: 2