RE: FTPing and Calling an EXE from a SQL Statement

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Michael Cheng [MSFT] (v-mingqc_at_online.microsoft.com)
Date: 01/22/05


Date: Sat, 22 Jan 2005 05:46:10 GMT

Hi Chris,

Thanks for your posting!

>From your descriptions, I understood that you would like to use FTP within
T-SQL statement and you would like to know whether it is possible for you
to execute exe file directly from T-SQL statement. Have I understood you?
Correct me if I was wrong.

For the first questions, yes, we are able to create FTP scripts 'on the
fly' and I find MVP oj have a good sample here

exec master..xp_cmdshell 'echo open ftp.{server name}.com > c:\ftp.input'
exec master..xp_cmdshell 'echo {user}>>c:\ftp.input'
exec master..xp_cmdshell 'echo {password}>>c:\ftp.input'
exec master..xp_cmdshell 'echo put {filepath & filename to
send}>>c:\ftp.input'
exec master..xp_cmdshell 'echo bye>>c:\ftp.input'
exec master..xp_cmdshell 'ftp -s:c:\ftp.input'

I am not sure what you would like to do with FTP so that I was not able to
provide more infomation on this. Here is another thread that I think might
help much.

http://groups-beta.google.com/group/microsoft.public.sqlserver.server/browse
_frm/thread/215cb2fd0459ce64/df62a4137206e879#df62a4137206e879

For the second questions, you could use xp_cmdshell to execute the exe
files, however, ONLY console will be executable and no inputs after
execution. Check xp_cmdshell for more detailed information.

BTW, I would like to suggest you how to find the some common issue with the
help of google.com, which I think will be the quickest way for you to get
the answer

http://groups-beta.google.com/advanced_search?q=group:microsoft.public.sqlse
rver.*

Thank you for your patience and corporation. If you have any questions or
concerns, don't hesitate to let me know. We are always here to be of
assistance!

Sincerely yours,

Michael Cheng

Online Partner Support Specialist
Partner Support Group
Microsoft Global Technical Support Center
---------------------------------------------------------------
Get Secure! - http://www.microsoft.com/security

This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks!



Relevant Pages

  • Re: exec/system wipes signal handler
    ... When you do an exec(), all of the code in memory ... new process image. ... array of pointers must be terminated by a NULL pointer. ... according to whether at least one file with suitable execute permissions ...
    (comp.lang.php)
  • Re: Application role to access xp_cmdshell
    ... This necessitates that your user procs be owned ... See Cross-database chaining in the SQL 2000 ... You will also need to allow non-sysadmin users to execute xp_cmdshell. ... EXEC sp_dboption 'MyDatabase', 'db chaining', true ...
    (microsoft.public.sqlserver.security)
  • Re: regex to find an stored proc name
    ... One major flaw in yours though is that is doesn't handle the return type as ... exec this a, b, c ... execute ... "Kevin Spencer" wrote: ...
    (microsoft.public.dotnet.languages.csharp)
  • Running a DTS Job from a stored procedure
    ... We now want to upgrade our SQL Servers to Windows 2003 server on a ... EXEC sp_DisplayOAErrorInfo @oPKG, @hr ... PRINT '*** Execute failed' ...
    (microsoft.public.sqlserver.dts)
  • Re: Sleep freezing
    ... >> man exec. ... > form of a standard shell pipeline where each arg becomes one ... > word of a command, and each distinct command becomes a sub- ... The word "execute" means to replace the program running in the calling ...
    (comp.unix.shell)