Hi
I'm trying to zip a Text file in SQL but once I run the command, sql keeps executing for long time and I don't get any error.
EXEC master..xp_cmdshell 'T:\Source\WinZip\winzip32.exe T:\Source\sso_pacingdata.zip T:\Source\sso_pacingdata.txt'
I also tried,
EXEC master..xp_cmdshell 'T:\source\WinZip\winzip32.exe -o T:\Source\sso_pacingdata.txt'
Probably my syntax is wrong. Can anyone please let me know the right syntax to Zip a Text file.
Thanks
Varsha
Ben
I can’t believe this,
As per your script, I wrote thio=s code and it actually worked…
exec master..xp_cmdshell '\\dell\tessitura\source\7-zip\7zG.exe a "\\dell\tessitura\source\sso_pacingdata.zip" "\\dell\tessitura\source\sso_pacingdataxt"'
but the SQL is not stopping. The Zip is ready but I haven’t got any return outut in SQL. It’s still executing…
what could be the problem? Does it need an output file?
Thanks a lot…
From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Ben Gu Sent: Tuesday, 7 December 2010 2:07 PM To: Varsha Karnik Subject: RE: [Tessitura Technical Forum] Zipping a txt file
Hi Varsha,
I found a very interesting thing in the xp_cmshell.
this one work:
exec master..xp_cmdshell 'c:\winzip\7z.exe a "c:\a\a.zip" "c:\a\a.txt"'
this one doesn't:
exec master..xp_cmdshell '"c:\winzip\7z.exe" a "c:\a\a.zip" "c:\a\a.txt"'
---
but
c:\winzip\7z.exe a "c:\a\a.zip" "c:\a\a.txt"
and
"c:\winzip\7z.exe" a "c:\a\a.zip" "c:\a\a.txt"
both work in cmd.
have fun
From: Ben Gu <bounce-bengu4278@tessituranetwork.com> Sent: 12/6/2010 8:42:37 PM
Good day.
here is a way to use xp_cmdshell.
steps to run xp_cmdshell. step1, stored procedure: create procedure lp_7zip WITH EXECUTE AS 'mynetwork\NetWorkAmdin' as begin exec master..xp_cmdshell 'c:\a\a.bat' ---it is in sql server c: drive end step2 in a.bat file -------------------------- cd\ "c:\winzip\7z.exe" a "\\mtc.com.au\mtc\Finance\Ben Gu\a\a.zip" "\\mtc.com.au\mtc\Finance\Ben Gu\a\a.txt" ------------------------------ step3 Credential account Credential name: ##xp_cmdshell_proxy_account## Identity: mynetwork\NetWorkAmdin passowrd: ********** Comfirm passowrd: *********
This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!
you can use no_output keyword if you want to.
http://msdn.microsoft.com/en-us/library/ms175046%28v=SQL.90%29.aspx
EXEC xp_cmdshell 'blabalbla', no_outputif you think there is a problem.you can check SQL logs or check Activity Monitor under Management.have funBen