Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    364

    Unanswered: sp results to text file

    Is there a way to write the results of an sp to a text file without using isql or osql?

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Sure

    Code:
    USE Master
    GO
    
    CREATE TABLE myTable99([text] varchar(8000))
    GO
    
    INSERT INTO myTable99([text]) EXEC sp_helptext sp_help
    DECLARE @cmd varchar(8000)
    SELECT @cmd = 'bcp master.dbo.myTable99 out d:\myTable99.txt -T -c -S'+@@SERVERNAME
    EXEC master..xp_cmdshell @cmd
    GO
    
    DROP TABLE myTable99
    GO
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Sep 2003
    Posts
    364
    Thanks Brett!

Posting Permissions

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