Showing posts with label xml-file. Show all posts
Showing posts with label xml-file. Show all posts

Friday, February 24, 2012

import an xml-file to sql2005

Dear all,
I'm trying to import an xml-file by passing the path i.e.
"D:\sql\project\bill_count_1.xml" to an db-procedure as in-param.
As a result whole the file-content should be saved in one column.
using SQL-2005.
The table looks like
create table test
(
id identity
, doc xml
)
You can solve the problem with openxml, openrowset, bulk insert and bcp
if you use the path as a string directly in the code but I could'nt
manage the import by sending the file-path as in-param to a db-proc
Thanks,
Every kind of help appr.
BR
AnwarHello anwar,
There's isn't any magic proc that does this for you. it can use dynamic SQL
inside of your own proc and openrowset to make this happen.
Cheers,
Kent Tegels
http://staff.develop.com/ktegels/

import an xml-file to sql2005

Dear all,
I'm trying to import an xml-file by passing the path i.e.
"D:\sql\project\bill_count_1.xml" to an db-procedure as in-param.
As a result whole the file-content should be saved in one column.
using SQL-2005.
The table looks like
create table test
(
id identity
, doc xml
)
You can solve the problem with openxml, openrowset, bulk insert and bcp
if you use the path as a string directly in the code but I could'nt
manage the import by sending the file-path as in-param to a db-proc
Thanks,
Every kind of help appr.
BR
AnwarHello anwar,
There's isn't any magic proc that does this for you. it can use dynamic SQL
inside of your own proc and openrowset to make this happen.
Cheers,
Kent Tegels
http://staff.develop.com/ktegels/

import an xml-file to sql2005

Dear all,
I'm trying to import an xml-file by passing the path i.e.
"D:\sql\project\bill_count_1.xml" to an db-procedure as in-param.
As a result whole the file-content should be saved in one column.
using SQL-2005.
The table looks like
create table test
(
id identity
, doc xml
)
You can solve the problem with openxml, openrowset, bulk insert and bcp
if you use the path as a string directly in the code but I could'nt
manage the import by sending the file-path as in-param to a db-proc
Thanks,
Every kind of help appr.
BR
Anwar
Hello anwar,
There's isn't any magic proc that does this for you. it can use dynamic SQL
inside of your own proc and openrowset to make this happen.
Cheers,
Kent Tegels
http://staff.develop.com/ktegels/

Import a XML file..?

Hi all,
I'm new to XML.
How can I import a XML-file to a SQL-table?
/Kent J.
Do you want the XML to be imported relationally? That is, into separate
tables?
Or do you just want to store the xml as text
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:FStgd.7428$d5.62954@.newsb.telia.net...
> Hi all,
> I'm new to XML.
> How can I import a XML-file to a SQL-table?
> /Kent J.
>
>
|||Jeff,
The XML-file consists of data about our customers - Customernumber,Address,
PhoneNumber and so on.
I would like the data to be stored in a single SQL-table.
/Kent J.
"Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
> Do you want the XML to be imported relationally? That is, into separate
> tables?
> Or do you just want to store the xml as text
> Jeff
> "Kent Johnson" <08.6044303@.telia.com> wrote in message
> news:FStgd.7428$d5.62954@.newsb.telia.net...
>
|||Look in Books Online under Writing XML using OPENXML
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:pDugd.7430$d5.63053@.newsb.telia.net...
> Jeff,
> The XML-file consists of data about our customers -
Customernumber,Address,
> PhoneNumber and so on.
> I would like the data to be stored in a single SQL-table.
> /Kent J.
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
>
|||Check out:
http://msdn.microsoft.com/library/de...ml/sql01c5.asp
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:FStgd.7428$d5.62954@.newsb.telia.net...
Hi all,
I'm new to XML.
How can I import a XML-file to a SQL-table?
/Kent J.
|||OK! I have read 'Writing XML Using OPENXML'
I understand that I first have to prepare the document with:
sp_xml_preparedocument
and then run....
OPENXML
But I'm not closer to solve the problem.
Can you describe how to import a XML-file into a SQL-table in a step-by-step
instruction?
/Kent J.
"Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...[vbcol=seagreen]
> Look in Books Online under Writing XML using OPENXML
> Jeff
> "Kent Johnson" <08.6044303@.telia.com> wrote in message
> news:pDugd.7430$d5.63053@.newsb.telia.net...
> Customernumber,Address,
separate
>
|||The docs have working examples..did you get one of those working? They are
very similar to your requirements.
You are familar with INSERT vs SELECT, correct?
Sorry, but I won't write the code for you. If you have a specific question,
I would be happy to assist.
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:Nbvgd.7438$d5.62925@.newsb.telia.net...
> OK! I have read 'Writing XML Using OPENXML'
> I understand that I first have to prepare the document with:
> sp_xml_preparedocument
> and then run....
> OPENXML
> But I'm not closer to solve the problem.
> Can you describe how to import a XML-file into a SQL-table in a
step-by-step
> instruction?
> /Kent J.
>
>
>
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> separate
>
|||You might want to venture to http://sqlxml.org for great info.
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:Nbvgd.7438$d5.62925@.newsb.telia.net...
> OK! I have read 'Writing XML Using OPENXML'
> I understand that I first have to prepare the document with:
> sp_xml_preparedocument
> and then run....
> OPENXML
> But I'm not closer to solve the problem.
> Can you describe how to import a XML-file into a SQL-table in a
step-by-step
> instruction?
> /Kent J.
>
>
>
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> separate
>

Import a XML file..?

Hi all,
I'm new to XML.
How can I import a XML-file to a SQL-table?
/Kent J.Do you want the XML to be imported relationally? That is, into separate
tables?
Or do you just want to store the xml as text
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:FStgd.7428$d5.62954@.newsb.telia.net...
> Hi all,
> I'm new to XML.
> How can I import a XML-file to a SQL-table?
> /Kent J.
>
>|||Jeff,
The XML-file consists of data about our customers - Customernumber,Address,
PhoneNumber and so on.
I would like the data to be stored in a single SQL-table.
/Kent J.
"Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
> Do you want the XML to be imported relationally? That is, into separate
> tables?
> Or do you just want to store the xml as text
> Jeff
> "Kent Johnson" <08.6044303@.telia.com> wrote in message
> news:FStgd.7428$d5.62954@.newsb.telia.net...
>|||Look in Books Online under Writing XML using OPENXML
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:pDugd.7430$d5.63053@.newsb.telia.net...
> Jeff,
> The XML-file consists of data about our customers -
Customernumber,Address,
> PhoneNumber and so on.
> I would like the data to be stored in a single SQL-table.
> /Kent J.
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
>|||Check out:
http://msdn.microsoft.com/library/d... />
ql01c5.asp
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:FStgd.7428$d5.62954@.newsb.telia.net...
Hi all,
I'm new to XML.
How can I import a XML-file to a SQL-table?
/Kent J.|||OK! I have read 'Writing XML Using OPENXML'
I understand that I first have to prepare the document with:
sp_xml_preparedocument
and then run....
OPENXML
But I'm not closer to solve the problem.
Can you describe how to import a XML-file into a SQL-table in a step-by-step
instruction?
/Kent J.
"Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> Look in Books Online under Writing XML using OPENXML
> Jeff
> "Kent Johnson" <08.6044303@.telia.com> wrote in message
> news:pDugd.7430$d5.63053@.newsb.telia.net...
> Customernumber,Address,
separate[vbcol=seagreen]
>|||The docs have working examples..did you get one of those working' They are
very similar to your requirements.
You are familar with INSERT vs SELECT, correct?
Sorry, but I won't write the code for you. If you have a specific question,
I would be happy to assist.
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:Nbvgd.7438$d5.62925@.newsb.telia.net...
> OK! I have read 'Writing XML Using OPENXML'
> I understand that I first have to prepare the document with:
> sp_xml_preparedocument
> and then run....
> OPENXML
> But I'm not closer to solve the problem.
> Can you describe how to import a XML-file into a SQL-table in a
step-by-step
> instruction?
> /Kent J.
>
>
>
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> separate
>|||You might want to venture to http://sqlxml.org for great info.
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:Nbvgd.7438$d5.62925@.newsb.telia.net...
> OK! I have read 'Writing XML Using OPENXML'
> I understand that I first have to prepare the document with:
> sp_xml_preparedocument
> and then run....
> OPENXML
> But I'm not closer to solve the problem.
> Can you describe how to import a XML-file into a SQL-table in a
step-by-step
> instruction?
> /Kent J.
>
>
>
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> separate
>

Import a XML file..?

Hi all,
I'm new to XML.
How can I import a XML-file to a SQL-table?
/Kent J.Do you want the XML to be imported relationally? That is, into separate
tables?
Or do you just want to store the xml as text
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:FStgd.7428$d5.62954@.newsb.telia.net...
> Hi all,
> I'm new to XML.
> How can I import a XML-file to a SQL-table?
> /Kent J.
>
>|||Jeff,
The XML-file consists of data about our customers - Customernumber,Address,
PhoneNumber and so on.
I would like the data to be stored in a single SQL-table.
/Kent J.
"Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
> Do you want the XML to be imported relationally? That is, into separate
> tables?
> Or do you just want to store the xml as text
> Jeff
> "Kent Johnson" <08.6044303@.telia.com> wrote in message
> news:FStgd.7428$d5.62954@.newsb.telia.net...
> > Hi all,
> >
> > I'm new to XML.
> > How can I import a XML-file to a SQL-table?
> >
> > /Kent J.
> >
> >
> >
>|||Look in Books Online under Writing XML using OPENXML
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:pDugd.7430$d5.63053@.newsb.telia.net...
> Jeff,
> The XML-file consists of data about our customers -
Customernumber,Address,
> PhoneNumber and so on.
> I would like the data to be stored in a single SQL-table.
> /Kent J.
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
> > Do you want the XML to be imported relationally? That is, into separate
> > tables?
> >
> > Or do you just want to store the xml as text
> >
> > Jeff
> >
> > "Kent Johnson" <08.6044303@.telia.com> wrote in message
> > news:FStgd.7428$d5.62954@.newsb.telia.net...
> > > Hi all,
> > >
> > > I'm new to XML.
> > > How can I import a XML-file to a SQL-table?
> > >
> > > /Kent J.
> > >
> > >
> > >
> >
> >
>|||Check out:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlpro01/html/sql01c5.asp
--
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:FStgd.7428$d5.62954@.newsb.telia.net...
Hi all,
I'm new to XML.
How can I import a XML-file to a SQL-table?
/Kent J.|||OK! I have read 'Writing XML Using OPENXML'
I understand that I first have to prepare the document with:
sp_xml_preparedocument
and then run....
OPENXML
But I'm not closer to solve the problem.
Can you describe how to import a XML-file into a SQL-table in a step-by-step
instruction?
/Kent J.
"Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> Look in Books Online under Writing XML using OPENXML
> Jeff
> "Kent Johnson" <08.6044303@.telia.com> wrote in message
> news:pDugd.7430$d5.63053@.newsb.telia.net...
> > Jeff,
> >
> > The XML-file consists of data about our customers -
> Customernumber,Address,
> > PhoneNumber and so on.
> > I would like the data to be stored in a single SQL-table.
> >
> > /Kent J.
> >
> >
> >
> > "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> > news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
> > > Do you want the XML to be imported relationally? That is, into
separate
> > > tables?
> > >
> > > Or do you just want to store the xml as text
> > >
> > > Jeff
> > >
> > > "Kent Johnson" <08.6044303@.telia.com> wrote in message
> > > news:FStgd.7428$d5.62954@.newsb.telia.net...
> > > > Hi all,
> > > >
> > > > I'm new to XML.
> > > > How can I import a XML-file to a SQL-table?
> > > >
> > > > /Kent J.
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>|||The docs have working examples..did you get one of those working' They are
very similar to your requirements.
You are familar with INSERT vs SELECT, correct?
Sorry, but I won't write the code for you. If you have a specific question,
I would be happy to assist.
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:Nbvgd.7438$d5.62925@.newsb.telia.net...
> OK! I have read 'Writing XML Using OPENXML'
> I understand that I first have to prepare the document with:
> sp_xml_preparedocument
> and then run....
> OPENXML
> But I'm not closer to solve the problem.
> Can you describe how to import a XML-file into a SQL-table in a
step-by-step
> instruction?
> /Kent J.
>
>
>
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> > Look in Books Online under Writing XML using OPENXML
> >
> > Jeff
> >
> > "Kent Johnson" <08.6044303@.telia.com> wrote in message
> > news:pDugd.7430$d5.63053@.newsb.telia.net...
> > > Jeff,
> > >
> > > The XML-file consists of data about our customers -
> > Customernumber,Address,
> > > PhoneNumber and so on.
> > > I would like the data to be stored in a single SQL-table.
> > >
> > > /Kent J.
> > >
> > >
> > >
> > > "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> > > news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
> > > > Do you want the XML to be imported relationally? That is, into
> separate
> > > > tables?
> > > >
> > > > Or do you just want to store the xml as text
> > > >
> > > > Jeff
> > > >
> > > > "Kent Johnson" <08.6044303@.telia.com> wrote in message
> > > > news:FStgd.7428$d5.62954@.newsb.telia.net...
> > > > > Hi all,
> > > > >
> > > > > I'm new to XML.
> > > > > How can I import a XML-file to a SQL-table?
> > > > >
> > > > > /Kent J.
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>|||You might want to venture to http://sqlxml.org for great info.
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:Nbvgd.7438$d5.62925@.newsb.telia.net...
> OK! I have read 'Writing XML Using OPENXML'
> I understand that I first have to prepare the document with:
> sp_xml_preparedocument
> and then run....
> OPENXML
> But I'm not closer to solve the problem.
> Can you describe how to import a XML-file into a SQL-table in a
step-by-step
> instruction?
> /Kent J.
>
>
>
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> > Look in Books Online under Writing XML using OPENXML
> >
> > Jeff
> >
> > "Kent Johnson" <08.6044303@.telia.com> wrote in message
> > news:pDugd.7430$d5.63053@.newsb.telia.net...
> > > Jeff,
> > >
> > > The XML-file consists of data about our customers -
> > Customernumber,Address,
> > > PhoneNumber and so on.
> > > I would like the data to be stored in a single SQL-table.
> > >
> > > /Kent J.
> > >
> > >
> > >
> > > "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> > > news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
> > > > Do you want the XML to be imported relationally? That is, into
> separate
> > > > tables?
> > > >
> > > > Or do you just want to store the xml as text
> > > >
> > > > Jeff
> > > >
> > > > "Kent Johnson" <08.6044303@.telia.com> wrote in message
> > > > news:FStgd.7428$d5.62954@.newsb.telia.net...
> > > > > Hi all,
> > > > >
> > > > > I'm new to XML.
> > > > > How can I import a XML-file to a SQL-table?
> > > > >
> > > > > /Kent J.
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>