http://qs1969.pair.com?node_id=615625

myuserid7 has asked for the wisdom of the Perl Monks concerning the following question:

I have dbi,Sybase,freetds setup and have no problem inserting text into MSSQL (SQL 2000).

I have a file on the filesystem, how do I prepare this file to be inserted into MSSQL?

Does the answer lie somewhere in binmode and pack?
  • Comment on How to prepare a file for insert into MSSQL

Replies are listed 'Best First'.
Re: How to prepare a file for insert into MSSQL
by thezip (Vicar) on May 15, 2007 at 19:58 UTC

    myuserid7,

    As an aside, I also have a FreeBSD box that has the same sort of setup as you have (DBI, DBD::Sybase, FreeTDS, connecting to MS SQL Server 2000). You've probably noticed that placeholders (?) are NOT supported in this configuration, so don't exert any effort towards this end.

    (Granted, I researched this over seven months ago, so the status may have changed since then...)


    Where do you want *them* to go today?
Re: How to prepare a file for insert into MSSQL
by EvanCarroll (Chaplain) on May 15, 2007 at 19:38 UTC
    I'm not sure what your question is, but you use binmode if you are reading in a non-text-file, and you use pack to prepare to write a data structure in a specified format. I'm guessing you need binmode, and not pack.

    You probably more want to look into $sth->bind_param, as some DBDs require you to manually bind them to use blob functionality. Run a quick google for Sybase, and blob.


    Evan Carroll
    www.EvanCarroll.com