Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2004
    Posts
    91

    Unanswered: Sp to write to a text file

    Hi everyone -

    running syabse asa7

    i would like to write to a text file
    when the procedure is called.

    Is there a way to append a line of text
    to a textfile from within sybase??

    thanks
    tony

  2. #2
    Join Date
    Jan 2003
    Location
    Geneva, Switzerland
    Posts
    353
    There is no direct way to write to a file from a stored proc (and that's a good thing, IMHO).

    You can however do a couple of things:

    You can use dbcc logprint or printtolog to write a message to the Sybase errorlog.

    You can write an Extended Stored proc (that runs in the XP server), and have that write to the file.

    You can maybe use the XFS extension which maps a directory as a table in Sybase.

    Michael

  3. #3
    Join Date
    Feb 2002
    Location
    Willy is on vacation
    Posts
    1,208
    asa7 allows writing to a file using re-directors.

    SELECT 'HELLO iAnywhere' >># F:\\myfile.txt

    Remember to call this within a stored proc, this construct should be part of EXEC IMMEDIATE and you can also supply variables.

Posting Permissions

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