This is a mirror of official site: http://jasper-net.blogspot.com/

Using SQL Server to Get the Column Names and Corresponding Datatypes in Particular Table

| Sunday, October 23, 2011
Here I will explain how to get the column names and corresponding datatypes in particular table using SQL Server.
Description:
I have one table with lot columns in database at that time I tried to know the column names and corresponding datatypes and their maximum sizes in particular table for that I written the following query in SQL server to get column names and datatypes in particular table.

USE MySampleDB 
GO

SELECT column_name 'Column Name',
data_type 'Data Type',
character_maximum_length 'Maximum Length'
FROM information_schema.columns
WHERE table_name = 'Country'

This is the demo

QR: using-sql-server-to-get-the-column-names-and-corresponding.aspx

Posted via email from Jasper-net

0 comments: