CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 1999
    Posts
    29

    execute file from SQL Server !

    How can I execute an exe-file from an SQL command?
    Or how I do thie from SQL-Server? Something like a
    trigger, but to execute a exe-file, not a stored procedure.


  2. #2
    Join Date
    Jul 1999
    Location
    Brazil
    Posts
    48

    Re: execute file from SQL Server !

    Hi

    Refer to 'sp_runtask' and 'SQL Executive' documentation.

    With 'sp_runtask' you can execute a previous created 'SQL Executive Task' that can be a 'CmdExec'.


    HIH


  3. #3
    Guest

    Re: execute file from SQL Server !

    exec @ret_status = master..xp_cmdshell 'name of your program'
    Example: xp_cmdshell 'copy c:\file.txt d:\bkup\file.txt'

    This will display the result from the program/DOS Command as a result-set. It returns the exit code of the program.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured