| || |
Getting sql stored procedure column names
I am trying to dynamically get the column names from a stored procedure at runtime. According to the silk helptext, the fuction DB_ColumnPrivileges seems like it would be the way to go. But when I try to use it, it only gives me the values "@Return_Value" and "@Items" (Items being the one input parameter to the stored procedure), and not any of the logical column names.
Here is my code:
<font class="small">Code:</font><hr /><pre>
[ ] list of string lsCols
[ ] HANDLE hstmnt = DB_ProcedureColumns (hdbc, null, null, "test_Rpt8", null)
[ ] string sCol, ignore, sProc
[-] while DB_FetchNext (hstmnt, ignore, ignore, sProc, sCol)
[ ] ListAppend (lsCols, sCol)
[ ] DB_FinishSql (hstmnt)
Am I looking in the wrong place for this information? Should this function be able to give me the column names of the restult of the stored procedure?
Re: Getting sql stored procedure column names
I've done some more digging, and it looks like the function DB_ProcedureColumns (which uses the ODBC utility 'SQLProcedureColumns') just gives you the names of the input and ouput parameters, not the names of the columns of the result set table.
What I need is a way to access those column names. Theoretically, when the function DB_ExecuteSql is run, there is an object somewhere that maps to the result set table (perhaps deep in ODBC itself) generated when the SQL query is run. Theoretically (again), this object should store not just the data in the table (which I can get with the DB_FetchNext function), but the column names as well.
I know that in other systems you are given a Result Set object of some type, which has utilities to access data more dynamically (such as by column name, or theoretically getting the column names themselves.) Is there any way to get this information in Silk?