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

Hello Guys, I need to generate a perl script to extract the DDL of all the tables residing in a schema in SQL server to flatfiles. I'm completely new to Perl scripting. Can you please guide me.
  • Comment on Perl script to extract SQL server table DDL into a flatfile

Replies are listed 'Best First'.
Re: Perl script to extract SQL server table DDL into a flatfile
by roboticus (Chancellor) on Jul 13, 2015 at 22:18 UTC

    abidshariff:

    I'd suggest installing DBI and playing with it a bit. Then when you're comfortable, review the bits on "table_info" and "column_info" to figure out how to read the information about tables and columns. Alternatively, you can use the various views your database provides to dig out the information you want. All the major databases I've used have views you can access to determine the structure of your database.

    Once you have that, it's a simple matter of coding to find the information you want, and format it into the output you want.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

A reply falls below the community's threshold of quality. You may see it by logging in.