Hi yaman bas,
first of all I need to apologize for recommending a solution that doesn't work on your platform...
I didn't pay enough attention to what forum you posted in...:blush:
But, [thank you, Barry! ;-)], my mistake has been detected, giving me the chance to correct it.
The following link might also be helpful:
http://www.sqlservercentral.com/articles/Advanced+Querying/queryingxmlfilesusingsql2000/822/
Here's my revised version:
create proc [dbo].[importxml] @doc ntext
as
DECLARE @idoc int
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
-- Execute a SELECT statement that uses the OPENXML rowset provider.
SELECT *
FROM OPENXML (@idoc, '/SALES_INVOICES/INVOICE',2)
WITH (TYPE int 'TYPE',
NUMBER varchar(10) 'NUMBER',
DATE varchar(18) 'DATE')
SELECT *
FROM OPENXML (@idoc, '/SALES_INVOICES/INVOICE/TRANSACTIONS/TRANSACTION',2)
WITH (TYPE int '../../TYPE',
NUMBER varchar(10) '../../NUMBER',
MASTER_CODE varchar(18) 'MASTER_CODE',
QUANTITY varchar(18) 'QUANTITY',
UNIT_CODE varchar(18) 'UNIT_CODE')
EXEC sp_xml_removedocument @idoc