Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi..

I have a stored procedure ..I want column names of the result data of that stored procedure
Here is my Requirement..


exec sp_empdetails 1

empno empname salary
----------------------
1 abc 10000

I want the column headings in a row wise

columnNames
-----------
empno
empname
salary
Posted

use below query to get list of columns(Row-wise) in particlar table
SQL
select column_name from information_schema.columns
where table_name='TableName'

Happy Coding!
:)
 
Share this answer
 
You didn't specify which language you are using. If you are using .Net, fill the datatable using sqldataadapter.

Suppose, you filled up the datatable named "dtbl"
Here is the code
foreach (DataColumn col in dtbl.Columns)
{
  //col.Caption
  //col.DataType
  //col.ColumnName
}


cheers
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900