Help for Storing Data From XML to Database  
Author Message
rautsarika





PostPosted: .NET Framework Data Access and Storage, Help for Storing Data From XML to Database Top

I have written the following Stored Procedure for Saving data from XML file to Database where the Database is SQL 2000

select Sp_CoCode, Sp_Year, Sp_DocType, Sp_DocNo, Sp_Prefix, Sp_PkNo, Sp_Location, Sp_AdNo, Sp_DocDate
From Trn_SalePur order by Sp_pkno desc
Update Trn_SalePur
SET XmlCol =(
SELECT * FROM OPENROWSET(
BULK 'C:\Test25102006.Xml',
SINGLE_BLOB
) AS x
)
WHERE IntCol = 1
GO

I am Gettting Error As while I am trying to execute the code:
Server: Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'BULK'.

Where My XML File contains following details:
<Trn_SalePur>
<Trn_SalePur Sp_CoCode="C05" Sp_Year="Y004" Sp_DocType="PU" Sp_DocNo="1418" Sp_Prefix="" Sp_PkNo="6396" Sp_Location="116" Sp_AdNo="80" Sp_DocDate="27/10/2006" />
</Trn_SalePur>

Can anyone help me to solve this problem. It is Very urgent.....



.NET Development8  
 
 
Glenn Block MSFT





PostPosted: .NET Framework Data Access and Storage, Help for Storing Data From XML to Database Top

Does the file exist at this location Your syntax looks correct.