views:

19

answers:

1

Hi. At work, the database is not documented at all. Furthermore, the stored procedures, functions and views are all encrypted, this rules out a lot of tools that document these objects for you. All I have are the plain .SQL files that generate the database, schemas, tables, functions and all.

I'd like to know, is there a tool that can read these files and generate a Doxygen-like documentation? Preferably open-source or freeware.

I found IzzySoft's HyperSQL and SourceForge's project PLDoc do something very close to what I'd need, though both seem to be very PL/SQL specific. I want something that reads SQL source files (that understands T-SQL's idiosyncracies), parses them, and gets me:

  • List of SPs, UDFs, etc. defined within each file
  • List of objects (both tables/views and procs/functions) each object depends on (directly and, if possible, also indirectly)
  • Calling and dependencies graphs (i.e. what calls what and is called by what)
  • If possible, when an SP uses a table/view, how's it using it (INSERT/DELETE/UPDATE/SELECT/mix???)

I've already developped a tiny Perl script that minimally parses these files attempting to get first point - but then it's just a hack and lacks a lot of polish. I'm sure there must be a tool out there which does the job, I want to believe I won't have to code it myself.

Thanks in advance, Joe

+1  A: 

We use Red Gate SQL Doc to generate ours.

However, it works from a database not files: it's easier to read everything from system tables (permission, dependecies, datatypes etc) than parse scripts. Parsing scripts is what the DB engine does...

Can you not generate an empty DB from the source files (remove WITH ENCRYPTION) and generate from that? Or decrypt if you have sa rights?

gbn
Yes, creting an empty db from files would be easier. Problem is: I don't have access to the installation scripts, which know the order in which to run the SQL files. I'd have to set dependencies myself to avoid creating a detail table before the header one...
Joe Pineda
Do you have sa to reverse the encryption then?
gbn
Right now I don't have SA permissions, though I may be able to request a backup to be restored with a diff. name and objects decrypted there. Security regulations are a bit tough here, hence objects must be encrypted :S Hoped going that way weren't the only one.
Joe Pineda