473,406 Members | 2,620 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,406 software developers and data experts.

Import XML file to database (MS Server 2000) using procedure (transact sql) ???

I must import some exemplary file to database (MS Srrver 2000) ofcourse
using procedure Transact SQL.
This file must:
1.Read the xml file
2. Create table
3. Import this date from xml file to my database

Ps. I create procedure who File xml imports to base, but unfortunately she
only schedule when earlier create a table or table is created.So I need (I
think) create such mini parser in language transact SQL.
Does someone have some ideas?

For every help Thanks

==== example file xml ===========================================
<root>
<Cust>
<IDosoby>1</IDosoby>
<Imie>Lukasz</Imie>
<Nazwisko>Przypadek</Nazwisko>
</Cust>
<Cust>
<IDosoby>2</IDosoby>
<Imie>Dariusz </Imie>
<Nazwisko>Mroz</Nazwisko>
</Cust>
<Cust>
<IDosoby>3</IDosoby>
<Imie>Tomasz</Imie>
<Nazwisko>Kolo</Nazwisko>
</Cust>
</root>
================================================== =========
--
Luk

Jul 20 '05 #1
3 5436
Not sure of the exact requirement. But if you can parse the XML and then
using OPENXML shred it into a new table.

SELECT * INTO <MyNewTable>
FROM OPENXML (@idoc, '/root/')

Where @idoc is the document handle of the internal representation of an XML
document.

--
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

"Szaki" <lj**@gazeta.pl> wrote in message
news:cm**********@inews.gazeta.pl...
I must import some exemplary file to database (MS Srrver 2000) ofcourse
using procedure Transact SQL.
This file must:
1.Read the xml file
2. Create table
3. Import this date from xml file to my database

Ps. I create procedure who File xml imports to base, but unfortunately she
only schedule when earlier create a table or table is created.So I need (I think) create such mini parser in language transact SQL.
Does someone have some ideas?

For every help Thanks

==== example file xml ===========================================
<root>
<Cust>
<IDosoby>1</IDosoby>
<Imie>Lukasz</Imie>
<Nazwisko>Przypadek</Nazwisko>
</Cust>
<Cust>
<IDosoby>2</IDosoby>
<Imie>Dariusz </Imie>
<Nazwisko>Mroz</Nazwisko>
</Cust>
<Cust>
<IDosoby>3</IDosoby>
<Imie>Tomasz</Imie>
<Nazwisko>Kolo</Nazwisko>
</Cust>
</root>
================================================== =========
--
Luk

Jul 20 '05 #2
Hi
May be it is not exactly what you wanted but I ma sure you will get an idea.

declare @list varchar(8000)
declare @hdoc int
set @list='<Northwind..Orders OrderId="10643"
CustomerId="ALFKI"/><Northwind..Orders OrderId="10692" CustomerId="ALFKI"/>'
select @list='<Root>'+ char(10)+@list
select @List = @List + char(10)+'</Root>'
exec sp_xml_preparedocument @hdoc output, @List

select OrderId,CustomerId
from openxml (@hdoc, '/Root/Northwind..Orders', 1)
with (OrderId int,
CustomerId varchar(10)
)
exec sp_xml_removedocument @hdoc

"Szaki" <lj**@gazeta.pl> wrote in message
news:cm**********@inews.gazeta.pl...
I must import some exemplary file to database (MS Srrver 2000) ofcourse
using procedure Transact SQL.
This file must:
1.Read the xml file
2. Create table
3. Import this date from xml file to my database

Ps. I create procedure who File xml imports to base, but unfortunately she
only schedule when earlier create a table or table is created.So I need (I think) create such mini parser in language transact SQL.
Does someone have some ideas?

For every help Thanks

==== example file xml ===========================================
<root>
<Cust>
<IDosoby>1</IDosoby>
<Imie>Lukasz</Imie>
<Nazwisko>Przypadek</Nazwisko>
</Cust>
<Cust>
<IDosoby>2</IDosoby>
<Imie>Dariusz </Imie>
<Nazwisko>Mroz</Nazwisko>
</Cust>
<Cust>
<IDosoby>3</IDosoby>
<Imie>Tomasz</Imie>
<Nazwisko>Kolo</Nazwisko>
</Cust>
</root>
================================================== =========
--
Luk

Jul 20 '05 #3
Thanks,
Could you correct my procedure that she acted correctly, becouse I'm a
beginning programist.
thanks for any help
Użytkownik "Vinod Kumar" <vinodk_sct@NO_SPAM_hotmail.com> napisał w
wiadomo¶ci news:cm**********@news01.intel.com...
Not sure of the exact requirement. But if you can parse the XML and then
using OPENXML shred it into a new table.

SELECT * INTO <MyNewTable>
FROM OPENXML (@idoc, '/root/')

Where @idoc is the document handle of the internal representation of an XML document.

--
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

"Szaki" <lj**@gazeta.pl> wrote in message
news:cm**********@inews.gazeta.pl...
I must import some exemplary file to database (MS Srrver 2000) ofcourse
using procedure Transact SQL.
This file must:
1.Read the xml file
2. Create table
3. Import this date from xml file to my database

Ps. I create procedure who File xml imports to base, but unfortunately she only schedule when earlier create a table or table is created.So I need

(I
think) create such mini parser in language transact SQL.
Does someone have some ideas?

For every help Thanks

==== example file xml ===========================================
<root>
<Cust>
<IDosoby>1</IDosoby>
<Imie>Lukasz</Imie>
<Nazwisko>Przypadek</Nazwisko>
</Cust>
<Cust>
<IDosoby>2</IDosoby>
<Imie>Dariusz </Imie>
<Nazwisko>Mroz</Nazwisko>
</Cust>
<Cust>
<IDosoby>3</IDosoby>
<Imie>Tomasz</Imie>
<Nazwisko>Kolo</Nazwisko>
</Cust>
</root>
================================================== =========
--
Luk


Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: M1st3rK3n | last post by:
I'm using the Transact-SQL Debugger for the first time here. I go to Object Browser, find my stored procedure, right click and choose "Debug". The "Debug Procedure" window comes up, and I...
2
by: Szaki | last post by:
Hello, I have a some xml file and database. How import this file to database? I must do aplication in VB .NET whose show imports some xml file to database SQL SERVER 2000? Do you have any idea?...
2
by: Manish Naik | last post by:
Hi, Using ASP.Net, I want to store and retrive documents (Word, excel, etc) from SQL Server 2000 database. I have tried image type data field, but could not succed. Can any one help me please. ...
1
by: davidman73 | last post by:
Hello, I have VS 2005 with SQL Server Express in the same machine, but need to connect to a remote SQL Server 2000. I'm getting this error: An error has occurred while establishing a...
0
by: Stanley Sin | last post by:
Dear all , How can I remote access SQL server 2000 using vb.net? I don't know how to use ADO.net to remote access database . Any solutions? Thanks in advance. Stanley
0
by: Emanuele | last post by:
I have write a program using MS Visual studio C++ 7.0 (platform Windows XP professional). I'm not using .NET. This program save data in a SQL server 2000 database using ADO. Everything works...
4
by: jayfeb29 | last post by:
Hi , Any one can guide me in Import the Excel 2002 data into sql server 2000 using ado.net1.1. I have searched all the forums most of the solutions end with a line of suggestion not with any code...
0
by: adhimoolamd | last post by:
Dear Friend’s, I need your help’s here to print the pdf file at server side using network printers. Here I am using System.Diagnostic.process namespace to print the pdf file. The problem is...
0
by: madhusr | last post by:
I have a requirement where in in I need to call a SQL Server 2000 stored procedure from DB2 (ver 8.x) based on a value in a column. I can create a trigger in DB2 to monitor the column and after the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.