Results 1 to 5 of 5

Thread: Need to automate output of SP to file

  1. #1
    Join Date
    May 2005
    Posts
    111

    Need to automate output of SP to file

    I have a stored procedure, SP_HELP_REVLOGIN, that I need to run everyday and have it's output saved to a text file. Any ideas how I can automate said process?

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Schedule it in SQL server or any other scheduler. You can use SQLCMD with -o parameter to save it to a file.

  3. #3
    Join Date
    May 2005
    Posts
    111
    what would the syntax look like for a stored procuder? i tried the following and received an error:

    sp_help_revlogin_ICS_4AUTOMATION -o c:\foo.txt

  4. #4
    Join Date
    Sep 2002
    Posts
    5,938
    Should be something like this and job step type is cmdexec:

    sqlcmd -S sql_instance_name -E -d db_name -q 'sp_help_revlogin_ICS_4AUTOMATION' -o c:\foo.txt

  5. #5
    Join Date
    May 2005
    Posts
    111
    THANK YOU!!! A colleague of mine has been trying to make this happen with SISS and VB for the past 3 months without success. Because of your help I got'r done in half a day. -A

Posting Permissions

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