Tech Off Thread

6 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

XML Column VS Relational Table

Back to Forum: Tech Off
  • User profile image
    Remon

    Hey Guys,
        Consider this entity:
    DEVICE contains
        Device Name, Bus Type, Installation Date, etc...
     and a composite attribute (DEVICE_FILES)
        FileID, FilePath 


    1 DEVICE -> Many DEVICE_FILES

    what should i use in such scenario with SQL 2K5 (Actually not pretty sure i should post this question here, if no tell me where plz)

    What to use ?
    1. Two Tables (1->M Relation)
    2. XML column contains the DEVICE_FILES in the DEVICES table ?

    The question is repeated if it's 1->1 Relation (what should i use?)

    It's just a descussion (someone told me USE TABLES NO XML) & he's a really good guy, got some books of his own. So if he's right then why ? if he's wrong then Why ? 

    Thanks  

  • User profile image
    figuerres

    Right, Wrong? No.

    the "right answer" is "It Depends"

    for example:

    if you are going to manage data on say hundreds of computers in a data center then a sql db might be the "right thing".

    if on the other hand you are packaging some info for one computer or one device to say install it.... then XML might be the better way to do it.

    sometimes a hybird is best, like a db with a row that includes an xml column to store part of the data. possibly there to allow you to generate an xml file that lists data for several devices on the fly.


    the "right answer" is often found by what you need to do with the data.... only in afew cases is there any really absolute single right answer.

  • User profile image
    Remon


    figuerres wrote:
    Right, Wrong? No.

    the "right answer" is "It Depends"

    for example:

    if you are going to manage data on say hundreds of computers in a data center then a sql db might be the "right thing".

    if on the other hand you are packaging some info for one computer or one device to say install it.... then XML might be the better way to do it.

    sometimes a hybird is best, like a db with a row that includes an xml column to store part of the data. possibly there to allow you to generate an xml file that lists data for several devices on the fly.


    the "right answer" is often found by what you need to do with the data.... only in afew cases is there any really absolute single right answer.



    No, that's not what i meant Smiley .. i mean to use 2 related DB tables DEIVICES & DEVICES_FILES ... or add the devices files as XML COLUMN in DEVICES TABLE.. not XML FILE

  • User profile image
    thepuffin

    XML will be slower, harder to query and far harder to write reports against. There are situations where you'd use an xml column, but this really isn't one of them!

  • User profile image
    Remon

    thepuffin wrote:
    XML will be slower, harder to query and far harder to write reports against. There are situations where you'd use an xml column, but this really isn't one of them!


    When should you use the XML columns then ?

  • User profile image
    TommyCarlier

    XML shouldn't be used for storing relational data. What XML is good at, is storing hierarchical data. That's why I don't like to serialize a DataTable as XML. XML is not a good format for storing tabular data.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.