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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Describe table

Status
Not open for further replies.

pdbowling

Programmer
Mar 28, 2003
267
US
Hello, Everyone.

When I used to work in Sybase, they had a function called Describe (utilized Describe myTableName) that would show the column names and data types of the table.

Is there something similar in SQL Server 2008? I googled a bit but everything seemed pretty complex.

Thank you,
Patrick
 

[bold]sp_help tblTableName[/bold] will get you what you're looking for...


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
select * from sys.columns
where object_id in (select object_id from sys.tables where name='YourTableName')

Simi
 
Or

SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'YourTableName'

-----------
With business clients like mine, you'd be better off herding cats.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top