Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hint on archiving data to XML file 2

Status
Not open for further replies.

fikir

Programmer
Jun 25, 2007
86
I am having a big task infront of me

I am trying to do dome archiving data which are 300 days and more older from our tables to xml files,

if any one have a link which discribes about this

Thanks
 
sorry I haven't finished my statements on the above post, I was rushing to a meeting.

what I need is a forum or any kind of post which desscribes how to archive old data to XML file

I really appreciate that

Thanks

 
Is this a 'once and done' task? Or do you need to do this regularly?


-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
this should be done regularly
 
You can add a 'for xml' clause to any query.

For example....

Code:
Select Column1, Column2
From   TableName
For    XML Auto

If you run this in query analyzer, you'll see the data. The trick is to send this to a file. Probably... the easiest way to get this in to a file is by using the osql command line utility with the [!]-o[/!] outputfile option. When using osql, be careful because the command line switches are case sensitive. To see the command line options for osql...

click start -> run
type CMD
click ok

at the DOS prompt, type
osql /?

I hope this helps.



-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
george,

there's a new For command in select!? very nice... have a * from me...

--------------------
Procrastinate Now!
 
Thanks for the star, but it's not so new. It's existed for more than 7 years now. (SQL 2000).

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
really?

surprised I've not come across it at all, thought it was a 2005 thing...

--------------------
Procrastinate Now!
 
Most Awesome George!

Even if it did exist, I did not know about it and can greatly use the FOR clause. Thanks and have a star.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top