Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query for finding available objects and columns...

Status
Not open for further replies.

PantherMills

Technical User
Oct 25, 2003
5
US
Is there any way to run a SQL query to show all the available objects and columns. I really don't know much about SQL, but I do know the line structure to do what I need if i could find the dang object and column. Thanks in advance.
Example: "select * from ? where ?"

edit: I posted this in another forum and I think it should have gone here.
 
You can't use a query to retrieve the tables and fields in Access. You can use the documenter to report your table structures (and almost everything else).

Duane
MS Access MVP
 
I'm actually running MSDE. (I guess this is the lite version of SQL server.) Is there a way for me to find the table structures?
 
There are system tables in SQL Server that store this information. The stored procedure sp_columns should provide all the information you need.

Duane
MS Access MVP
 
Use the information_schema views. They are documented in Books on Line.
 
Example of information schema on Northwind database.

Select T.Table_type, C.Table_name, C.Column_Name, C.Data_Type
From Northwind.information_schema.tables T
Inner join Northwind.information_schema.columns C ON T.Table_name = C.Table_name
Where T.table_type='BASE TABLE'
 
Example of getting information from system tables.

Select so.name, sc.name from sysobjects so
inner join syscolumns sc on so.id = sc.id
--where so.xtype = 'U'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top