Use the INFORMATION_SCHEMA views to access the schema information:
SELECT
COLUMN_NAME,
DATA_TYPE,
CHARACTER_MAXIMUM_LENGTH
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Customers'
This will return all the column names, data type and length for character
data, one row per column.
I hope this helps,
Jon
"Jason Manfield" <Ja***********@discussions.microsoft.com> wrote in message
news:39**********************************@microsof t.com...
Given a table name (e.g. CUSTOMERS), how do I get column names of the
table
and the data types of the columns the table has?
I am using SQLServer and would like to get that info from my C# code.