Systems, Solutions, Software & Stuff
Microsoft SQL Server 2000 provides a method for obtaining meta data using information schema views.
List all user tables in the pubs database, we’re not interested in views
SELECT * FROM information_schema.tables WHERE table_type = 'base table'
List only the table names
SELECT table_name FROM information_schema.tables WHERE table_type = 'base table'
List all columns in the authors table
SELECT * FROM information_schema.columns WHERE table_name = 'authors'
List only the column names
SELECT column_name FROM information_schema.columns WHERE table_name = 'authors'