Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

T-SQL (2000) List Tables, Columns Expand / Collapse
Author
Message
Posted Wednesday, May 15, 2013 2:02 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, May 30, 2013 8:14 AM
Points: 19, Visits: 55
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.
Post #1453265
Posted Wednesday, May 15, 2013 2:11 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, May 30, 2013 8:14 AM
Points: 19, Visits: 55
Found the answer on another site:
select DB_NAME() as Database_name, * from information_schema.columns
Post #1453270
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse