T-SQL (2000) List Tables, Columns

  • In T-SQL (2000), I have a query that lists all Tables and Columns, along with Data Types.

    select *

    from information_schema.columns

    order by table_name, ordinal_position

    However, I have multiple databases on the SQL Server and I don't see which Database the Tables belong too. Any ideas on how I can adjust this to give the database along with the tables. Or a method I can run this against a specific database, rather than all databases. Thanks.

  • Found the answer on another site:

    select DB_NAME() as Database_name, * from information_schema.columns

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply