I have the following xml document
<XML_Articles>
<Articles>
<ID>12</ID>
<ReferenceNum>123</ReferenceNum>
<ArName>الهدف</ArName>
<EnName>GOAL</EnName>
<PublicationDate>2016-11-15</PublicationDate>
<TypeID>15</TypeID>
<CreatedBy>2</CreatedBy>
<CreatedOn>2016-11-15</CreatedOn>
</Articles>
</XML_Articles>
insert them into table by
INSERT INTO dbo.Articles
(ReferenceNum,ArName,EnName,PublicationDate,PublisherID,TypeID,CreatedBy,CreatedOn)
SELECT * FROM OPENROWSET(BULK 'C:\Users\dana_\Desktop\DataBase\Assignments\Assignement 6\Articles.xml',SINGLE_BLOB) AS x
But I get an error:
The select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of INSERT columns.
SINGLE_BLOB
is exactly how it sounds. It's a 'single-row, single-column rowset of type varbinary(max).' Read the documentation onOPENROWSET
msdn.microsoft.com/en-us/library/ms190312.aspx