Saturday, May 19, 2012

How to Get List of Columns Name,Data types of Table


Here I am explained you how to get the List of Columns and their datatypes from particular Table using SQL.

For Example i have a Table Office.write a querry


USE master
GO
SELECT column_name 'Column Name',
data_type 'Data Type',
character_maximum_length 'Maximum Length'
FROM information_schema.columns
WHERE table_name = 'Office'

where master=Database Name ,'Office' is a Table Name

After run this Querry you will get


0 comments:

Post a Comment