[dba-SQLServer] Where do I find

kens.programming kens.programming at verizon.net
Thu Dec 6 14:07:40 CST 2007


There are two ways to find this, John.  The two system tables you would find
this in are sysobjects (tables) and syscolumns (columns).  However, there
are also a set of specialized views called INFORMATION_SCHEMA, in this case
you would use INFORMATION_SCHEMA.COLUMNS.  This way you don't have to
interpret the data in the sys... tables.  It will give you the tablename,
columname, datatype, fieldlength, etc., etc.

SELECT * FROM INFORMATION_SCHEMA.COLUMNS

Ken


-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Thursday, December 06, 2007 11:54 AM
To: dba-sqlserver at databaseadvisors.com
Subject: [dba-SQLServer] Where do I find

What would the SQL look like to get a list of all the field names in a
table?  I assume that there are system tables with this stuff but it is kind
of slow poking around trying to find that.

John W. Colby
Colby Consulting
www.ColbyConsulting.com 

_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.503 / Virus Database: 269.16.15/1174 - Release Date: 12/6/2007
10:11 AM
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.503 / Virus Database: 269.16.15/1174 - Release Date: 12/6/2007
10:11 AM
 




More information about the dba-SQLServer mailing list