473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

XMl Import

sir,

I Have a Problem in xml data importing Plese help me in this .
when i m insertning data through Application it is inserting but while I am using Store Procedure its giving the error

Running [dbo].[sp_xmlbulkinsert] ( @xmldata = D:\xml\rfid\Branches.xml, @table_name = Branches, @Action = xmlImport ).

The XML parse error 0xc00ce556 occurred on line number 1, near the XML text "D:\xml\rfid\Branches.xml".
The error description is 'Invalid at the top level of the document.'.
sp_xml_removedocument: The value supplied for parameter number 1 is invalid.
No rows affected.

And my SP is



Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. GO
  4.   ALTER PROC [dbo].[sp_xmlbulkinsert] 
  5.    @xmldata varchar(max) =null,
  6.    @table_name varchar(50),
  7.    @Action varchar(50)   
  8.    AS
  9.    Begin
  10.    SET NOCOUNT ON
  11.     if @Action='xmlImport'
  12.         begin
  13.         declare    @statement varchar(200)
  14.         DECLARE @hDoc int
  15.         DECLARE @error INT 
  16.  
  17.          exec sp_xml_preparedocument @hDoc OUTPUT, @xmldata  
  18.                 set @statement ='Insert Into '+ @table_name    +' '+ 'SELECT * FROM OPENXML('+ convert(varchar, @hDoc) +','+     
  19.                     '''/NewDataSet/Table''' +',2) with '+ @table_name  ;
  20.                   execute (@statement)
  21.          EXEC sp_xml_removedocument @hDoc
  22.           --  end
  23.      end
  24.  
  25.      else if @Action='xmlExport'
  26.             begin 
  27.           set @statement='Select * from '+  @table_name
  28.           execute (@statement)
  29.       end                                                                                      --'+convert(varchar,@hDoc)+ '
  30.   end
  31.  

---------

In @xmldata parameter I m Passing the Path D:\xml\rfid\Branches.xml is it correct or not

Please help me for this
Mar 30 '12 #1
0 1442

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Stian Sřiland | last post by:
all examples performed with: Python 2.3+ (#2, Aug 10 2003, 11:09:33) on linux2 (2, 3, 0, 'final', 1) This is a recursive import:
0
by: Vio | last post by:
Hi, I've been trying to embed (statically) wxPy alongside an embedded py interpreter on a linux/gtk box. At one point, for some reason misc.o linking reported "multiple definitions of...
0
by: John Roth | last post by:
I've found a case where it seems that Python is importing two copies of a module without any reason or indication. It took me a while to verify that this is what is occuring: I had to write a...
5
by: Steve Holden | last post by:
This is even stranger: it makes it if I import the module a second time: import dbimp as dbimp import sys if __name__ == "__main__": dbimp.install() #k = sys.modules.keys() #k.sort() #for...
1
by: mark | last post by:
In Access 2000 and 2002, I have created an import specification to import the fixed-width recordset below into an existing table. I am having strange problems with the import of the date and time...
4
by: Bruce W. Roeser | last post by:
All, I'm reading a book by Charles Petzold (Programming VS.Net). Pretty good content but am confused about the difference. From the text: ...
2
by: Jon | last post by:
It appears that (windows) python searches in the current working directory before looking in the local site-packages directory, or that '.' comes first in sys.path? The problem arises when I made...
7
by: Ron Adam | last post by:
from __future__ import absolute_import Is there a way to check if this is working? I get the same results with or without it. Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) on win 32 ...
5
by: W. Watson | last post by:
Is there a single source that explains these statements? ------------------------------ from Tkinter import * from Numeric import * import Image import ImageChops import ImageTk import time...
9
by: rsoh.woodhouse | last post by:
Hi, I'm trying to work out some strange (to me) behaviour that I see when running a python script in two different ways (I've inherited some code that needs to be maintained and integrated with...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.