Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 4th, 2007, 10:14 AM
Authorized User
 
Join Date: Dec 2006
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default Compress and Uncompress in SQL Server

I've new requirement in my project. Could any tell me how to compress and uncompress the file.

1. First, I've to BCP the data from database to flat file in the
   destination folder
2. Once that is done, I've to compress the entire folder
3. Also, i need to uncompress the folder when i want restore the
   data back into the database table.

I really don't know how to accomplish the task. Please provide me some sample code which would help me in understanding the task more clearly.

Thanks in advance
Chandra


Chandru
__________________
Thanks,
Chandra
 
Old December 4th, 2007, 01:15 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The most popular compression format on the PC is ZIP. There are lots of compression tools out there. Some have command line interfaces so you could easily run them programmatically.

The .NET framework has compression classes in it. There is also a 3rd party .NET library for zipping that works well: http://www.icsharpcode.net/OpenSource/SharpZipLib/


-Peter
 
Old December 10th, 2007, 05:10 AM
Authorized User
 
Join Date: Dec 2006
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Rather than using third party tool, i would like to call ZIP Command line utility from SQL Server using XP_CMDSHELL. I'm also sure the ZIP Program should be installed in the server which is running SQL Server. Could you pls. tell me way to go further to achieve my task through this approach.

Chandru
 
Old December 10th, 2007, 10:53 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Quote:
quote:Originally posted by carumuga
 Rather than using third party tool, i would like to call ZIP Command line utility from SQL Server

The ZIP CLI program is 3rd party.

Quote:
quote:
 I'm also sure the ZIP Program should be installed in the server which is running SQL Server.
Yes, it would need to be installed.

What have you learned about the XP_CMDSHELL procedure so far?


-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Conflict in SQL Server 2000 and SQL Server 2005 ayan.mukherjee SQL Language 0 June 30th, 2008 03:34 AM
SQL Server Reg. SQL Server does not exist error Arsi SQL Server 2000 1 June 11th, 2008 11:20 AM
Compress (roll-up) table data jamez36 SQL Server 2000 1 July 4th, 2007 01:39 PM
Compress and Repair Damaged Database owain Access 4 June 30th, 2003 05:55 AM
How to compress a Database ? darkdog SQL Server 2000 3 June 20th, 2003 03:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.