Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2005
    Posts
    4

    Unanswered: Stored Procedure Question

    In a stored procedure, how can I pip the result of a select statement to a text or ascii file? How can I append to an existing file?

    I used:

    SELECT * FROM Employee WHERE EmployeeType = 'Active' ># @filePath

    but it does not work properly. The same statement works fine in dbisqlc!!!

    I appreciate if someone could help me on this.

    Regards.

  2. #2
    Join Date
    Apr 2003
    Posts
    6
    You can use isql for these.

    isql -Uuser -SServer -Ppassword -iinput.sql -ooutput.out

    http://www.dbasupport.com.mx

  3. #3
    Join Date
    Oct 2005
    Posts
    4
    Thanks for the post but how do I use the isql in a stored procedure?

  4. #4
    Join Date
    Jan 2003
    Location
    Geneva, Switzerland
    Posts
    353
    You can't do that directly.

    You may be able to get something to work via the XP server (look up Extended Stored procedures), or maybe via the XFS extension (which maps a directory as a Sybase table).

    An alternative would be to write the output you want to a table, and have an outside job read the table and write that output to the text file.

    Michael

  5. #5
    Join Date
    Feb 2004
    Location
    UK
    Posts
    43

    Use fsql

    U can use fsql like this :

    fsql -D<DB Name> -U<user_id> -P<password> -S<Server> -c"exec <SP Name> " -I $SYBASE/interfaces > /tmp/sp_mig_insert_user.csv


    ~Pankaj

Posting Permissions

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