Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy command to see table column datatypes

Status
Not open for further replies.

hapax

Programmer
Nov 10, 2006
105
0
0
US
I recently found a nice command "sp_helptext mysproc" that lists the definition of a stored procedure.

Is there anything equivalent to list the definition for a table?

I'm always wanting to find out the datatypes for table columns. We have so many tables it's a pain to find the table in Enterprise Manager, right click, and choose "Script table as..." > "Create to..." - which the only way I know how to do it.
 
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'YourTableName'
AND TABLE_SCHEMA = 'YourSchema' --(Usually dbo unless you are using other schemas in your database)
 
Code:
SELECT * FROM INFORMATION_SCHEMA.Columns WHERE Table_Name  = 'YourTable'
[code]

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top