Bulk insert into sql database using xml file within stored proc not working
I created the following table
CREATE TABLE [absorbentorder] (
[dpc] [char] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[absorbentcode] [char] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[quantity] [char] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
Here is the code for the stored proc:
CREATE PROC AbsorbentOrderBulkInsertXML @items nText
AS
DECLARE @hDoc int
exec sp_xml_preparedocument @hDoc OUTPUT, @items
Insert Into absorbentorder
SELECT dpc, absorbentcode, quantity
FROM OPENXML (@hDoc, '/absorbentitems',1)
WITH (dpc char(15), absorbentcode char(15), quantity char(15)) XMLItems
EXEC sp_xml_removedocument @hDoc
GO
Here is the parameter for the stored proc
<absorbentitems><item dpc="501"></item><item absorbentcode="CL1022"></item><item quantity="6"></item><item dpc="501"></item><item absorbentcode="CL1088"></item><item quantity="8"></item><item dpc="501"></item><item absorbentcode="CL1193"></item><item quantity="8"></item></absorbentitems>
thanks!
Alex Zaff
alex@cleanalliance.com
Hazardous Waste Management Services (http://www.cleanalliance.com/environmentalservices/hazardousnonhazardouswastemanagement.htm)

