PDA

View Full Version : How to get table name, PK field, FK field from SQL Server Datbase


kennypoon
03-25-02, 01:12
I'm using VB to write a application to call SQL server database.
i'm using ADO-ODBC to connect to the database.
How can i get all the table name from the database, and also how can i get the primary key field, foriegn key field from a given table?

kharsa60
03-25-02, 04:20
type select * from sysobjects where name=<table_name>

kharsa60
03-25-02, 04:22
or using stored procedure sp_help within the active database