Retrieving Column Names of a table

Sbanerjee
Posted by in Sql Server category on for Beginner level | Views : 5088 red flag

Retrieving Column Names of a table from database using SQL
Introduction

Recently I was in a requirement to find all column names w.r.t. a database table. I found the solution and thought this may be useful for others too. So compiling it here under this SQL Server section.

Retrieving Column Names of a table using SQL:-

CREATE PROCEDURE [GetTableColumns]

(

   @TableName VARCHAR(30)

)

AS

BEGIN

         SELECT Column_Name FROM INFORMATION_SCHEMA.COLUMNS WHERE

               Table_Name=@TableName

END 

Conclusion
We have created our own stored procedure for retrieving table columns.
Page copy protected against web site content infringement by Copyscape

About the Author

Sbanerjee
Full Name: Soumen Banerjee
Member Level: Starter
Member Status: Member
Member Since: 6/9/2008 6:54:20 AM
Country: India

http://www.ethicaldeveloper.blogspot.com/
Learning has no end, keep spreading knowledge as it increases self knowledge. Cheers

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)