Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been tasked with writing a script to do some file processing, and I need to be able to do a simple query against a SQL server to verify the counts on the server match up to how many the database thinks there should be.

Since I've never done much (any) DB access with perl, before I get started I wanted to query the great minds here as to what is the best option for querying a MSSQL DB from perl? I've done a couple of searches but nothing too definitive has come up.

One limitation - I'm running perl 5.8.0 on that box and upgrading isn't an option right now.

I know this is one of those borderline SO/SF questions - if the concensus is that is a SO question i'll cast the 5th migration vote myself ;)

share|improve this question
up vote 3 down vote accepted

Yes, you can query MSSQL DB from perl. There are two options, either through a DBD::ODBC, or DBD::Sybase.

You didn't say what the box is (update: it was in the tags). If the box is MS then ODBC will be easier. If not probably Sybase. Thanks to FreeTDS both are possible.

I'll go one step further and say ODBC is an DBI abstraction layer, Sybase connectivity must work for ODBC to work, so it is always a step more.

share|improve this answer
It is true that his post didn't specify his host OS, but the tags contain 'linux.' +1 for you, you gave a fuller answer than I did. – mfinni Feb 10 '10 at 19:22

Look up DBI and DBD. There's a whole ORA book on exactly this topic.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.