How to Get Column Names From a Specific Table?

Pinal Dave, blogger and speaker, posted about SQL Server – How to Get Column Names From a Specific Table? where he showed two methods to get column names for a specific table.

There are two other simple methods to do the same

Let us create this table

use tempdb

create table #testing(id int, names varchar(100))

Method 1 Use System stored procedure sp_columns

EXEC sp_columns  '#testing'

The result is as shown below

col1

Method 2 Highlight the table name and press ALT+F1

#testing

The result is as shown below

col2

SQL Server provides various ways to retrieve column information for a table

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s