in reply to Reading from databse and writing to file.

Part of the problem with code like this (for me) is the tangle of database statements and perl code. Database coding can be strange because the syntax often depends on the database you're connecting to. What might work with Sybase might not work with MS SQL Server. I'm not familiar with Sybase. It looks like your basic DBI calls are correct--except it appears that you're opening both a SQL connection and a Sybase connection. Why two? Do you mean to do that?

Can Sybase manage stored procedures? I've sometimes found it helpful to put complicated data calls into stored procedures and then just run the procedure from the perl script. MS-SQL would look something like:
$sql = "{call procedure_name( '$any-input-values')}";

#call the procedure $db->Sql($sql);

The rest of it seems conceptually workable, but I'm not experienced enough to advise you there. Just a minor point, you never close your OUTFILE. I always thought it was good practice to do so.

Replies are listed 'Best First'.
Re: Re: Reading from databse and writing to file.
by mpeppler (Vicar) on May 21, 2003 at 13:31 UTC
    Coming in a little late on this, but just an FYI - MS-SQL is derived from Sybase code (MS purchased the code from Sybase back in 1992 or so), so yes, Sybase can do stored procedures.

    Michael