Click to See Complete Forum and Search --> : table names collection in SQL Server 2000


reenacutie
January 11th, 2005, 09:10 PM
Need your help plzzzzzzzzz....
i need to extract table and fiald names in visual C++ from an SQL database and use these table nad field names to perform String matching with a Natural language in a Natural language query analyzer. i don't know how to extract these names. Is there a direct SQL Query with which i can obtain these names?

Krzemo
January 12th, 2005, 12:01 AM
OpenSchema if U use ADO/oledb. There is also similar function in ODBC.

As a "direct query" U can use some standard stored procedures:

EXEC sp_tables
EXEC sp_pkeys
etc.

OR U can select directly from system tables...

(sysobjects,syscolumns,....)

Best regards,
Krzemo.

Davey
January 15th, 2005, 02:37 PM
Have a look at the INFORMATION_SCHEMA.* views,

e.g.

select * from information_schema.tables