in reply to Understanding Code which uses pipe to bulk copy data

You cannot use the 'pipe command' to bcp data out of a sybase server.
You have to use a named pipe.

Do something like this:

Create a named pipe:

mknod /tmp/bcp-pipe p
Start a bcp-session:
bcp mydb..mytable out /tmp/bcp-pipe -c -Uuser -Sserver
And then you can read from that pipe in your perl program:

open FIFO, '/tmp/bcp-pipe' or die "cannot open /tmp/bcp-pipe: $!\n"; while (<FIFO>) { print "bcp-data: $_"; } close FIFO;

Replies are listed 'Best First'.
Re: Re: Understanding Code
by dreman (Acolyte) on Aug 20, 2001 at 17:48 UTC
    Thanks for your information, one more question. If I was attempting to complete this task on Window NT, would it be possible creating a pipe and using it. Thanks. Dre Create a named pipe: mknod /tmp/bcp-pipe p Start a bcp-session: bcp mydb..mytable out /tmp/bcp-pipe -c -Uuser -Sserver And then you can read from that pipe in your perl program: open FIFO, '/tmp/bcp-pipe' or die "cannot open /tmp/bcp-pipe: $!\n"; while (<FIFO>) { print "bcp-data: $_"; } close FIFO;
      What I wrote works on *nix.
      I don't know, if you can create named pipes in NT, I've never heard of it.