Thursday, July 12, 2007

A T-SQL script extracting DB schema info

Sometime I need to get a full view of a MS SQL database's schema details, e.g. user table and its columns, constraints, indexes, etc. And I prefer a plain text output instead of others (let's say XML). Since MS doesn't provide this and I can't find one from web, I wrote a script to implement this on my own:-

TSQL script

The output is tab spearated and can be easily imported into Excel/Access for a better look.

In write this I found TSQL in SQL 2000 is really depressing in constrast to PL/SQL. It event doesn't provide a convenient way of exporting output into an external file, as SPOOL command of PL/SQL does, unless COM is used. More terrible is the lack of support for parameterized cursor as well as 'inline' procedures or functions.

Does SQL 2005 provide any significant enhancements?

341 comments:

«Oldest   ‹Older   401 – 341 of 341
«Oldest ‹Older   401 – 341 of 341   Newer› Newest»