Re: how to insert xml into sql 2005
  Home FAQ Contact Sign in
microsoft.public.sqlserver.xml only
 
Advanced search
POPULAR GROUPS

more...

 Up

>>
>>
>> Secretary Deck [603103]
>>

>>
>> Secretary Base [603101]
>>

>>
>> White Glove Platinum
>>

>>

>>
>>
>> AV1011-FS-BASS
>> Bass Industries Avalon [AV1011-FS-BASS]
>> http://www.bizchair.com/-av1011-bass.html
>> NO
>> NO
>>
>> >> Url="http://www.bizchair.com/bass-industries.html">Bass
>> Industries

>>

>>

>>
>>
>> MA1061-FS-BASS
>> Bass Industries Matinee Lounger
>> [MA1061-FS-BASS]

>> http://www.bizchair.com/-ma1061-bass.html
>> NO
>> NO
>>
>> >> Url="http://www.bizchair.com/bass-industries.html">Bass
>> Industries

>>

>>

>>
>>
>> OY7701-CMF
>> Community Olympia Lounge Chair
>> [OY7701-CMF]

>> http://www.bizchair.com/-oy7701-cmf.html
>> NO
>> NO
>>
>> >> Url="http://www.bizchair.com/community.html">Community
>>

>>

>>
>>
>> Thanks Mike. If I could I would attach text files of the xml file.
>>
>> Dee
>>
>>
>> "Mike C#" wrote:
>>
>>> Do me a favor, try opening the XML file in Internet Explorer. What
>>> result
>>> do you get?
>>>
>>> "Dee" discussions.microsoft.com> wrote in message
>>> news:73260B01-419E-4E93-9D56-488BEEE88ADB@microsoft.com...
>>>>I have tried the following and only get one column in the database and
>>>>it
>>>>can
>>>> not be read. It seems as if nothing is in it and it takes a long
>>>> time to
>>>> open.
>>>>
>>>> DECLARE @xml XML;
>>>> use yahoostore
>>>> CREATE TABLE Products(xmlCol XML)
>>>> INSERT Products
>>>>
>>>> SELECT
>>>> -- @xml = BulkColumn
>>>> CONVERT(XML, BulkColumn, 2)
>>>> FROM OPENROWSET (BULK 'C:\database\xmldtd\yahoostore.xml',
>>>> SINGLE_BLOB)xyz
>>>>
>>>> Do you have any suggestions?
>>>>
>>>> Thank you
>>>> Dee
>>>>
>>>>
>>>>
>>>> "Dee" wrote:
>>>>
>>>>> Mike this is what I am getting in the table:
>>>>> USE [yahoostore]
>>>>> GO
>>>>> /****** Object: Table [dbo].[Products] Script Date: 01/21/2008
>>>>> 13:54:11
>>>>> ******/
>>>>> SET ANSI_NULLS ON
>>>>> GO
>>>>> SET QUOTED_IDENTIFIER ON
>>>>> GO
>>>>> CREATE TABLE [dbo].[Products](
>>>>> [xmlCol] [xml] NULL
>>>>> ) ON [PRIMARY]
>>>>>
>>>>> Thanks
>>>>> Dee
>>>>>
>>>>>
>>>>> "Dee" wrote:
>>>>>
>>>>>> I never did get
>>>>>>
>>>>>> FROM @xml.nodes('/Products/Product') Products (x);
>>>>>>
>>>>>> to work. I am reading and trying. What is the xyz?
>>>>>>
>>>>>> So far I am getting nothing to work and errors message and I try
>>>>>> to
>>>>>> find out
>>>>>> what they are and try what ever I can.
>>>>>>
>>>>>> Thanks
>>>>>> Dee
>>>>>>
>>>>>>
>>>>>>
>>>>>> "Mike C#" wrote:
>>>>>>
>>>>>>> I assume, since you moved on to the next step of adding the
>>>>>>> INSERT,
>>>>>>> that you
>>>>>>> got the shred working properly with no errors. By "directory" I
>>>>>>> assume you
>>>>>>> mean "table". SQL Server provides only very limited support for
>>>>>>> DTDs.
>>>>>>> Try
>>>>>>> giving OPENXML a correlation name:
>>>>>>>
>>>>>>> SELECT CONVERT(XML, BulkColumn, 2)
>>>>>>> FROM OPENROWSET (BULK 'C:\database\xmldtd\yahoostore.xml',
>>>>>>> SINGLE_BLOB) xyz
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> "Dee" discussions.microsoft.com> wrote in message
>>>>>>> news:A87085E2-821A-4CC7-B17A-8FBBAD707C26@microsoft.com...
>>>>>>>> Mike,
>>>>>>>>
>>>>>>>> I got the following message with that:
>>>>>>>>
>>>>>>>> Msg 2389, Level 16, State 1, Line 8
>>>>>>>> XQuery [value()]: 'value()' requires a singleton (or empty
>>>>>>>> sequence),
>>>>>>>> found
>>>>>>>> operand of type 'xdt:untypedAtomic *'
>>>>>>>>
>>>>>>>>
>>>>>>>> I also tried using this because my xml file has dtd in it,
>>>>>>>> hence
>>>>>>>> the
>>>>>>>> directory xmldtd:
>>>>>>>>
>>>>>>>> DECLARE @xml XML;
>>>>>>>> CREATE TABLE Products(xmlCol XML)
>>>>>>>> INSERT Products
>>>>>>>>
>>>>>>>> SELECT
>>>>>>>> -- @xml = BulkColumn
>>>>>>>> CONVERT(XML, BulkColumn, 2)
>>>>>>>> FROM OPENROWSET (BULK 'C:\database\xmldtd\yahoostore.xml',
>>>>>>>> SINGLE_BLOB)
>>>>>>>>
>>>>>>>> Product
>>>>>>>>
>>>>>>>> SELECT * FROM Product
>>>>>>>>
>>>>>>>>
>>>>>>>> It create a directory named produdcts, but the only column was
>>>>>>>> an
>>>>>>>> xml
>>>>>>>> column
>>>>>>>> with nothing in it.
>>>>>>>>
>>>>>>>> Dee
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> "Dee" wrote:
>>>>>>>>
>>>>>>>>> Sorry to keep posting, but I do look these up first, just not
>>>>>>>>> getting the
>>>>>>>>> correct error of what I need to change.
>>>>>>>>>
>>>>>>>>> I am now getting:
>>>>>>>>>
>>>>>>>>> Msg 318, Level 15, State 0, Line 42
>>>>>>>>> The table (and its columns) returned by a table-valued method
>>>>>>>>> need
>>>>>>>>> to be
>>>>>>>>> aliased.
>>>>>>>>>
>>>>>>>>> Also will this insert the data from the xml file into the
>>>>>>>>> database?
>>>>>>>>>
>>>>>>>>> Thank you and I am trying to find these things out as I go.
>>>>>>>>> Dee
>>>>>>>>>
>>>>>>>>> "Mike C#" wrote:
Re: how to insert xml into sql 2005         

Group: microsoft.public.sqlserver.xml · Group Profile
Author: Mike C#
Date: Jan 23, 2008 08:54

Hi Dee,

The first thing I noticed is that your XML is not well-formed. Look at this
snippet:

  • Pulaski Secretary
  • Regent finish

  • Hand painted
  • Deck Includes:
  • Glass framed
    door
  • Adjustable glass shelves
  • Base Includes:


  • Notice that the and
  • tags are not properly nested. This is one
    problem. I fixed the tags in your sample, but now the document is invalid
    against the Yahoo Store DTD it references (the Caption element can't contain
  • tags).

    "Dee" discussions.microsoft.com> wrote in message
    news:8CBC64E8-46F1-4819-AB03-A815B09C5130@microsoft.com...
  • > When I tried to open the xml file on my computer which is not the server I
    > am
    > going to eventually be using. It lock the computer because the xml files
    > has
    > everything and saes information in it from our store.'
    >
    > Thank you
    > Dee
    >
    > "Dee" wrote:
    >
    >>
    >> Here is an exmaple of the code taken from the xml file. It is too large
    >> to
    >> post the entire file.
    >>
    >>
    >> >> "http://store.yahoo.com/doc/dtd/StoreExport.dtd">
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >> BizChair - Free Shipping on Office Chairs
    >> USD
    >>
    >>
    >>
    >> Ground
    >>

    >>
    >> Visa
    >> MasterCard
    >> American Express
    >> Discover
    >> Diner's Club
    >> JCB
    >> Optima
    >> Amazon
    >> Purchase Order
    >> Check
    >>

    >>

    >>
    >>
    >> 603103-FSTI-PUL
    >> Pulaski Secretary [603103-FSTI-PUL]
    >> http://www.bizchair.com/-603103-pul.html
    >> 160
    >> YES
    >> YES
    >>
    >> 794.99
    >> 794.99
    >> 1083.44
    >> 1083.44
    >> 794.99
    >> 794.99
    >>

    >>
    >> >> Url="http://www.bizchair.com/home-furniture1.html">Home
    >> Furniture

    >> >> Url="http://www.bizchair.com/homefurniture-manufacturers.html">Home
    >> Furniture
    >> Manufacturers

    >> >> Url="http://www.bizchair.com/pulaski.html">Pulaski
    >>

    >> This item typically ships in 1 - 2
    >> weeks

    >>
  • Pulaski Secretary
  • Regent finish

  • >>
  • Hand painted
  • Deck Includes:
  • Glass framed
    >> door
  • Adjustable glass shelves
  • Base
    >> Includes:

  • >>
  • Three drawers
  • Drop lid desk
  • Pull out support

  • >>
  • Antique Brass finish hardware
  • Come to BizChair.com for
    >> all
    >> your Secretary Desks and Home Furniture needs!
  • A blend of contemporary edge, softness and
    >> comfort
  • A great synergy of design, special relationship and
    >> function
  • Life time warranty on frames, springs, and moving
    >> parts
  • 2 year warranty
  • Come to BizChair.com for all
    >> your
    >> Home Theater Furniture and for all your Home Furniture
    >> needs!
  • Available in Black Leather Only
  • Straight Row
    >> Only
  • Motorized Recline
  • Chaise Styling
  • Space
    >> Saver
  • Life time warranty on all frames, springs and moving
    >> parts
  • 5 year warranty on leather
  • 2 year warranty on all
    >> other
    >> materials
  • Come to BizChair.com for all your Home Theater
    >> Furniture
    >> and for all your Home Furniture needs!
  • Community Olympia Lounge Chair

  • >>
  • Comfortable proportion with relaxed lounge appeal
  • The
    >> geometric
    >> shapes of the Olympia collection impart a true sense of repose and
    >> support
  • Constructed with acute attention to
    >> detail
  • Features
    >> solid hardwood frames with wood legs for ultimate stability
  • Seat
    >> and
    >> back cushions utilize high density polyurethane padding for enduring
    >> comfort
    >> and lasting support
  • Has an even coat of a no-wipe stain,
    >> followed by
    >> a coat of sealer
  • Legs are available in Maple Beech
    >> finishes
  • Personalize your furniture by choosing from the wide
    >> variety
    >> of fabrics and vinyls
  • Matching Sofa and Loveseat available

  • >>
  • Click Here to view http://www.bizchair.com/oy7703-cmf.html">
    >> Olympia Sofa
  • Click Here to view >> href="http://www.bizchair.com/oy7702-cmf.html">Olympia Loveseat

  • >>
  • Come to BizChair.com for all your Lounge Chairs and Office
    >> Furniture
    >> needs!
  • no comments
    diggit! del.icio.us! reddit!