[dba-SQLServer] Table Definition

Ken Stoker kens.programming at verizon.net
Fri Aug 27 13:05:53 CDT 2004


I have always copied the results out to Excel and worked with it from there.
The column names aren't included in the copy/paste, so you will need to put
those in if you need them.  

One other thing, the query I provided doesn't return fields with user
defined types.  I did some more playing around and the best way is to
replace sc.xtype = st.xusertype with sc.xusertype = st.xusertype.

Ken

-----Original Message-----
From: Joseph O'Connell [mailto:joconnell at indy.rr.com] 
Sent: Friday, August 27, 2004 10:43 AM
To: dba-sqlserver at databaseadvisors.com; kens.programming at verizon.net
Subject: Re: [dba-SQLServer] Table Definition

Ken,

Thank you for your prompt reply.  This query does give me the information
that I need.

Is there an easy way to print the results of the query?

Joe O'Connell

-----Original Message-----
From: Ken Stoker <kens.programming at verizon.net>
To: dba-sqlserver at databaseadvisors.com <dba-sqlserver at databaseadvisors.com>
Date: Friday, August 27, 2004 12:10 PM
Subject: RE: [dba-SQLServer] Table Definition


|Will this work for you?
|
|SELECT so.name AS TableName, sc.name AS FieldName, st.name AS Type,
| sc.Length, sc.Prec, sc.Scale
|FROM sysobjects so INNER JOIN syscolumns sc on so.id = sc.id
| INNER JOIN systypes st on sc.xtype = st.xusertype
|WHERE so.name = 'mytablename'
|
|Ken
|
|-----Original Message-----
|From: dba-sqlserver-bounces at databaseadvisors.com
|[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Joseph
|O'Connell
|Sent: Friday, August 27, 2004 9:33 AM
|To: dba-sqlserver at databaseadvisors.com
|Subject: [dba-SQLServer] Table Definition
|
|In an Access application, I can use the Documenter tool to generate a
report
|of table definitions.
|
|Is there an equivalent tool in SQL Server that will easily create a report
|showing the Name, Data Type and Size of the fields in a selected table?
|
|Joe O'Connell
|
|
|
|_______________________________________________
|dba-SQLServer mailing list
|dba-SQLServer at databaseadvisors.com
|http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
|http://www.databaseadvisors.com
|
|_______________________________________________
|dba-SQLServer mailing list
|dba-SQLServer at databaseadvisors.com
|http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
|http://www.databaseadvisors.com
|





More information about the dba-SQLServer mailing list