January 2, 2014 at 11:51 pm
Hi All,
How to unzip file by using T-SQL Script ? any Examples pls...?
January 3, 2014 at 2:59 am
Can't be done directly from t-sql. You need to invoke the command line using xp_cmdshell. There are plenty of zip tools around which provide a CLI and give you their syntax.
If you're using a job you could do this using powershell as an alternative to the standard command line.
A final alternative, you could write your own CLR function for SQL Server.
January 3, 2014 at 4:18 am
MysteryJimbo (1/3/2014)
Can't be done directly from t-sql. You need to invoke the command line using xp_cmdshell. There are plenty of zip tools around which provide a CLI and give you their syntax.If you're using a job you could do this using powershell as an alternative to the standard command line.
A final alternative, you could write your own CLR function for SQL Server.
Thanks for you reply... I googled on this batch file i got some idea.. but i couldn't get fully .. Can u please provide one example by using xp_cmdshell.
January 3, 2014 at 4:19 am
MysteryJimbo (1/3/2014)
Can't be done directly from t-sql. You need to invoke the command line using xp_cmdshell. There are plenty of zip tools around which provide a CLI and give you their syntax.If you're using a job you could do this using powershell as an alternative to the standard command line.
A final alternative, you could write your own CLR function for SQL Server.
Thanks for your reply... I googled on this batch file i got some idea.. but i couldn't get fully .. Can u please provide one example by using xp_cmdshell.
January 3, 2014 at 4:56 am
Do what I'd do, and type "xp_cmdshell" into your favourite search engine. If you're not familiar with the command line syntax of whatever zip utility you're using, you'll need to look that up as well. Post back if you get stuck on anything in particular.
John
January 3, 2014 at 4:57 am
There are lots of examples right here on the site. Just do a search for xp_cmdshell and zip.
Here's one example here. And another. And one more[/url]. There are still others to be found.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
January 3, 2014 at 5:27 am
Thanks for you help.. i got it...
June 19, 2024 at 8:09 pm
I just published an article (https://www.sqlservercentral.com/articles/unzipping-word-documents-in-tsql) that explains how to natively unzip in T-SQL
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply