I asked:
> Does anyone here know how to access field names and types from tables via an ODBC 
>connection to databases in SQL Server?

and I got two quick (and useful) solutions. 

(METHOD 1)
Darrell Connelly wrote:
>From the database in question:

SELECT * FROM sysobjects WHERE xtype = 'U'

will give you the tables, 'U' stands for "user"

from the above you can determine the ID of the table.

Then you can select the columns with:

SELECT * FROM sysobjects WHERE ID = <IDNUMBERHERE>

(METHOD 2)
With SQL 7 a new object exists, the information_schmema object
which is
view.

SELECT * FROM information_schema.tables
for tables
SELECT * FROM information_schema.columns
for tables, columns, types, lengths, etc.

Bo Thomsen also suggested the second method.

Thanks, guys!
-- 
- Bill Thoen
------------------------------------------------------------ 
GISnet, 1401 Walnut St., Suite C, Boulder, CO  80302
tel: 303-786-9961, fax: 303-443-4856
mailto:[EMAIL PROTECTED], http://www.gisnet.com/
------------------------------------------------------------



_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to