in reply to Re: Perl scripts to do extraction into Sybase
in thread Perl scripts to do extraction into Sybase

thank you for the prompt reply.. and apologies for putting so much in one Qs. :) anyways, let me rephrase my Qs: how would you load data from a flat file into a sybase database using perl scripts?
  • Comment on Re: Re: Perl scripts to do extraction into Sybase

Replies are listed 'Best First'.
Re: Re: Re: Perl scripts to do extraction into Sybase
by hotyopa (Scribe) on Jan 10, 2001 at 04:09 UTC

    2 issues for you, best tackled one at a time. I've had to learn to do them both over the last little while, and barely suffered at all :)

    1. Reading flat files. This is a v. basic example which reads the file line at a time and prints the results. You could modify this approach to send to Sybase instead:
      #!/usr/local/bin/perl -w if (open(MYFILE, "path/to/file")) { $line = <MYFILE>; while ($line ne "") { print ($line); $line = <MYFILE>; } }
    2. Talking to a Sybase database. You'll need to come to grips with DBI/DBD. I doubt you will find it too difficult. It is pretty much a case of connecting to the database, executing an SQL command, then retrieving the results. The Tricks with DBI tutorial by btrott should head you off in the right direction.

      Have a look at davorg's reply below as well :)

    *~-}o{-~*