Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004
    Posts
    15

    Unanswered: write in and read from My_File.txt

    Hi ..
    I want to Write in files or read from files
    for example i have My_File.txt . i need a syntax and i want to call this syntax in my Store procedure and this syntax write forexample " Hello Word " in My_File.txt .
    and i want another syntax that read from My_File.txt forexample "Word" from My_File.txt . what are those syntaxes do that ??

    thanks

  2. #2
    Join Date
    Oct 2003
    Posts
    84
    xp_CmdShell lets you run shell commands from an sql script...(you need proper rights)


    so:

    EXEC xp_CmdShell 'type MyFile.txt'

    displays the contents

    and

    EXEC xp_CmdShell 'echo ' + @MyData + ' > MyFile.txt';

    should write to it... use >> to append to the file.


    There might be a better way to do this..

Posting Permissions

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