Re: using xml format to import data to sql 2k

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



On Mon, 27 Aug 2007 11:53:21 -0400, "mecn" <mecn2002@xxxxxxxxx> wrote:

Hi,

1. Instead of text delimiter, an xml format data could imported to sql 2k
tables?

Yes, you can easily import XML data.


2. The same way import text files? --fast and less resource? what is the
benefit of using xml instead of T-sql

There are plusses and minuses.

XML files tend to be MUCH larger than CSV or plain-text files.

It can sometimes be difficult to convert XML data to fully relational
data.

You can lose the purity of the relational model, if you leave the data
in its XML format.

3. How do I generate an xml format table schma?

There are many ways.

In the simplest, you don't really do anything, just create a table
with an XML column, and read the whole XML file into that column!

create table mytable
(
field1 int,
field2 varchar(255),
field3 XML
)

Then you can read an entire XML file into it with something like:

INSERT INTO mytable(field1, field2, field3)
SELECT 1, 'foo', * FROM OPENROWSET(
BULK 'c:\SampleFolder\SampleData3.xml',
SINGLE_BLOB) AS x

http://msdn2.microsoft.com/en-us/library/ms191184.aspx

There is a *lot* of stuff in SQLServer 2005 to support XML.

I'm just learning it myself.

It can be very confusing, but is also very powerful.

Josh

.



Relevant Pages

  • Re: xml in plain text file on heavy load.
    ... even if the XML file is magically and perfectly ... I want to emphasize that IIS would never be caching that XML file on its own ... Application is NOT synchronizing access to your ASP pages. ...
    (microsoft.public.inetserver.iis)
  • Re: TAPI 3.0 call attached data
    ... The format of the Call Attached Data is XML. ... XML file with CallAttchedData represents one or multiple data lists ... Root element is CallAttachedData. ... version CDATA #FIXED "1.0" ...
    (microsoft.public.win32.programmer.tapi)
  • Re: XML parser and writer
    ... them on a calendar. ... Therefore I will need to both easily parse and write new XML files. ... why not some database technology? ... an advanced user can edit the XML file directly at ...
    (comp.lang.java.programmer)
  • Re: Zooming Out: The Larger Issue
    ... XML file or a binary file (smaller and faster to serialize deserialize, ... On startup of your app you could just check if the xml / binary file exists ... datarow = the container of one or more datacolumns wich in there turn hold ...
    (microsoft.public.dotnet.languages.vb)
  • Re: XmlTextReader or XmlDocument or SQLCE
    ... I wouldn't really call it "unrealistic expectations", ... I would love to see a 1 second response time ... reading a single node from a 200k XML file on any version of CF running on ... > As to saving XML file after each change, ...
    (microsoft.public.dotnet.framework.compactframework)