Unix Technical Forum

Reading an XML table from a SQL field

This is a discussion on Reading an XML table from a SQL field within the SQL Server Data Warehousing forums, part of the Microsoft SQL Server category; --> We have a SQL table that consists of several fields, one of which we know is an XML dump ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server Data Warehousing

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-16-2008, 01:39 PM
=?Utf-8?B?SmFtZXM=?=
 
Posts: n/a
Default Reading an XML table from a SQL field

We have a SQL table that consists of several fields, one of which we know is
an XML dump from a table. The thing is, we don't know how to extract the
data out of the XML table that resides in this field. For example, here is a
single record of part of the table. The XML resides in the field labeled
'Data':

UnitID ManufacturedDate Data
0001eb5761f24313... 2006-08-01
0x3C0055006E00690074004500780...

The 'Data' field is an 'image' data type.

Does anyone know how to convert that data back into something that is
useable??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-16-2008, 01:39 PM
Mike C#
 
Posts: n/a
Default Re: Reading an XML table from a SQL field

Image is just a Large Object (LOB) binary data type. Are you on SQL 2000?

"James" <James@discussions.microsoft.com> wrote in message
news:82EA9DD3-78D9-417E-B647-B54D77BD368E@microsoft.com...
> We have a SQL table that consists of several fields, one of which we know
> is
> an XML dump from a table. The thing is, we don't know how to extract the
> data out of the XML table that resides in this field. For example, here
> is a
> single record of part of the table. The XML resides in the field labeled
> 'Data':
>
> UnitID ManufacturedDate Data
> 0001eb5761f24313... 2006-08-01
> 0x3C0055006E00690074004500780...
>
> The 'Data' field is an 'image' data type.
>
> Does anyone know how to convert that data back into something that is
> useable??



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-16-2008, 01:39 PM
=?Utf-8?B?SmFtZXM=?=
 
Posts: n/a
Default Re: Reading an XML table from a SQL field

Yes, this particular table is.

"Mike C#" wrote:

> Image is just a Large Object (LOB) binary data type. Are you on SQL 2000?
>
> "James" <James@discussions.microsoft.com> wrote in message
> news:82EA9DD3-78D9-417E-B647-B54D77BD368E@microsoft.com...
> > We have a SQL table that consists of several fields, one of which we know
> > is
> > an XML dump from a table. The thing is, we don't know how to extract the
> > data out of the XML table that resides in this field. For example, here
> > is a
> > single record of part of the table. The XML resides in the field labeled
> > 'Data':
> >
> > UnitID ManufacturedDate Data
> > 0001eb5761f24313... 2006-08-01
> > 0x3C0055006E00690074004500780...
> >
> > The 'Data' field is an 'image' data type.
> >
> > Does anyone know how to convert that data back into something that is
> > useable??

>
>
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-20-2008, 05:55 PM
=?Utf-8?B?TUw=?=
 
Posts: n/a
Default Re: Reading an XML table from a SQL field

SQL Server 2000 has only poor support of the XML data type. You could,
however, pull the data over to a SQL Server 2005 instance (e.g. Express
Edition) and manipulate it there.

On SQL 2000, however, your best option is to use a client application to
manipulate XML data (or any other large data type).


ML

---
Matija Lah, SQL Server MVP
http://milambda.blogspot.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-24-2008, 06:09 AM
Mike C#
 
Posts: n/a
Default Re: Reading an XML table from a SQL field

I agree with ML, your best bet is to manipulate the data using a client
application or get it somewhere with some decent support for XML. If you
have a SQL 2005 instance handy you could probably set up a linked server to
the 2000 instance pretty easily.

One other thing you might be able to do is use OPENXML to grab the data, but
it's been a while so I can't recall if OPENXML would support a path
expression like //*. If I recall correctly OPENXML also returns data in a
special table format if you don't specify the result table structure, so you
might be able to get element names, etc., that way. You'd probably be a lot
better off just manipulating it outside of SQL Server 2000 though.

"James" <James@discussions.microsoft.com> wrote in message
news:71AC28D2-FE11-468C-B647-73AC21720648@microsoft.com...
> Yes, this particular table is.
>
> "Mike C#" wrote:
>
>> Image is just a Large Object (LOB) binary data type. Are you on SQL
>> 2000?
>>
>> "James" <James@discussions.microsoft.com> wrote in message
>> news:82EA9DD3-78D9-417E-B647-B54D77BD368E@microsoft.com...
>> > We have a SQL table that consists of several fields, one of which we
>> > know
>> > is
>> > an XML dump from a table. The thing is, we don't know how to extract
>> > the
>> > data out of the XML table that resides in this field. For example,
>> > here
>> > is a
>> > single record of part of the table. The XML resides in the field
>> > labeled
>> > 'Data':
>> >
>> > UnitID ManufacturedDate Data
>> > 0001eb5761f24313... 2006-08-01
>> > 0x3C0055006E00690074004500780...
>> >
>> > The 'Data' field is an 'image' data type.
>> >
>> > Does anyone know how to convert that data back into something that is
>> > useable??

>>
>>
>>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:19 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com