borg48
asked on
How to get column names an types from a sql statement
If a stored procedure that just returns a select statement or an embededded sql:
select * from test_table;
How do you do it in ado.net to figure out the column names and its data types?
For example test_table has the columns first_name varchar(15), mi char(1), last_name varchar(25), date_created datetime.
Thanks
select * from test_table;
How do you do it in ado.net to figure out the column names and its data types?
For example test_table has the columns first_name varchar(15), mi char(1), last_name varchar(25), date_created datetime.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
FROM sysobjects INNER JOIN syscolumns ON sysobjects.id = syscolumns.id
INNER JOIN systypes ON dbo.syscolumns.xtype = dbo.systypes.xtype
WHERE sysobjects.xtype='U' AND sysobjects.name='Table1'