SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How To Save XML File To A DataBase
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

TittiSkaria
Starting Member

India
16 Posts

Posted - 09/09/2010 :  01:09:04  Show Profile  Reply with Quote
Hi Friends ,
How To Save A Whole XML Into DataBase? Consider That I Have a XML File Named MyXML.xml,Then I have To Store This XML To The DataBase.Can Anyone Please Help To Solve This ....It is Possible To Save The Whole XML Into A DataBase Table By Declaring That Particular Column's Variable Type As XML ...I Want To Know How To Save My XML File Into A Location In DataBase Other Than Table And How To Retrieve It..Expecting A Quick And Clear Reply...
Regards And Thanks ,
Titt.S

tkizer
Almighty SQL Goddess

USA
37129 Posts

Posted - 09/09/2010 :  01:20:52  Show Profile  Visit tkizer's Homepage  Reply with Quote
Other than table? What do you mean by that?


Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

TittiSkaria
Starting Member

India
16 Posts

Posted - 09/09/2010 :  01:57:00  Show Profile  Reply with Quote
Thanks For Your Reply..Im A NewBie To SQL DataBases..I Just Want To Know Is It Possible To Store XML Just Like We Are Saving Query's In Views...Sorry If Im Wrong...So Saving Some Datas In DataBase Means That Saving It To Tables ????

Thanks And Regards,
Titti.S
Go to Top of Page

Sachin.Nand
Flowing Fount of Yak Knowledge

2937 Posts

Posted - 09/09/2010 :  02:16:55  Show Profile  Reply with Quote
Yes you can.
Read more about Filestream for SQL 2008 in BOL.



Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

TittiSkaria
Starting Member

India
16 Posts

Posted - 09/09/2010 :  02:28:19  Show Profile  Reply with Quote
Hi Thanks For Your Reply Idera..Can You Give Me A Clear Picture.....Is It SomeThing Like Hosting A XML TO DataBase..And Can I See Where My XML File Is Stored In DataBase..??

Thanks And Regards,
Titti.S
Go to Top of Page

Sachin.Nand
Flowing Fount of Yak Knowledge

2937 Posts

Posted - 09/09/2010 :  02:39:26  Show Profile  Reply with Quote
Have a look here

http://www.sqlservercentral.com/articles/SQL+Server+2008/64088/


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

TittiSkaria
Starting Member

India
16 Posts

Posted - 09/09/2010 :  03:37:07  Show Profile  Reply with Quote
Well Thanks Again For Your Kind Reply...Can You Tell Me Which Way Is More Faster?? ie) To Storing And Accessing XML In
DataBase Table Or In FileStream !!..Can You Post Me An Example .....??
Go to Top of Page

TittiSkaria
Starting Member

India
16 Posts

Posted - 09/09/2010 :  07:38:23  Show Profile  Reply with Quote
Hi AnyOne There To Help Me Out...Please...

Thanks And Regards,
Titti.S


Go to Top of Page

Sachin.Nand
Flowing Fount of Yak Knowledge

2937 Posts

Posted - 09/09/2010 :  07:58:10  Show Profile  Reply with Quote
quote:
Originally posted by TittiSkaria

Well Thanks Again For Your Kind Reply...Can You Tell Me Which Way Is More Faster?? ie) To Storing And Accessing XML In
DataBase Table Or In FileStream !!..Can You Post Me An Example .....??



What do u mean by XML in DB?
From your first post I am assuming that you have a xml file which you want to save it in the table.


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

TittiSkaria
Starting Member

India
16 Posts

Posted - 09/09/2010 :  08:27:33  Show Profile  Reply with Quote
Hi Idera,
Actually I Need To Store My XML Into DataBase For Easy Retreiving The Datas When I Need It.I Have Just Saved My XML To DB Table Successfully..But I Want To Know Is There AnyOther Location Or Option Available For Saving My XML Other Than Table...Which Means In FileStream Or SomeWhere In DB.. Which is Better And Faster..To Save It In DB Table As Just Did Or To Save In FileStream ??????

Thanks And Regards,
Titti.S
Go to Top of Page

Sachin.Nand
Flowing Fount of Yak Knowledge

2937 Posts

Posted - 09/09/2010 :  08:39:19  Show Profile  Reply with Quote
Well it depends on how you want it.if you have physical xml files & want to save them then go filestream or else just use xml datatype to save xml in the table.

I would go for xml datatype & would add xml indexes to it for fast retrieval.


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

Lamprey
Flowing Fount of Yak Knowledge

4614 Posts

Posted - 09/09/2010 :  11:01:28  Show Profile  Reply with Quote
If your XML files are under 2GB each you can store them in a column using the XML datatype. For example:
CREATE TABLE MyTable
(
	MyXmlColumn XML
)
You can read more about using XML in SQL in BOL (Book Online).
Go to Top of Page

TittiSkaria
Starting Member

India
16 Posts

Posted - 09/09/2010 :  23:39:19  Show Profile  Reply with Quote
Hi Friends,
Thanks For Your Replies...Ok My XML Files Are Under 2GB,So Im Going With The Way Of Storing It In Table.Then Regarding FileStreams I Will Definitely Give It A Try..

Thanks And Regards,
Titti.S
Go to Top of Page

siliumang
Starting Member

1 Posts

Posted - 09/10/2010 :  07:17:31  Show Profile  Reply with Quote
spam removed
Go to Top of Page

claudiu
Starting Member

2 Posts

Posted - 11/23/2010 :  19:14:53  Show Profile  Reply with Quote
Not sure if this topic is still open, but here is an awesome post: http://www.developer.com/db/article.php/3565996.

It basically saves the XML document inside a database table, in an XML type field. You can then use XQuery language to query the XML field and extract whatever data you want from your XML field. I tried that before, it works well, although kinda' slow, not sure if it's our inability to optimize it or something else.

Claudiu
Go to Top of Page

claudiu
Starting Member

2 Posts

Posted - 11/23/2010 :  19:18:22  Show Profile  Reply with Quote
Just realized, the URL is http://www.developer.com/db/article.php/3565996

Crazy dot at the end...

C.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000