Re: Stored Procedure Columns

From: Val Mazur (group51a_at_hotmail.com)
Date: 05/29/04


Date: Fri, 28 May 2004 22:29:32 -0400

Hi,

You have several options:
1. You would need to create INSERT SQL statement, which will insert column
names first. In this case you would need to loop through the fields, grab
their names and prepare SQL statement
2. You could try to use SQL DTS library, which allows export/import data
between SQL Server and other datasources. I think you could specify in a DTS
to transfer column names

-- 
Val Mazur
Microsoft MVP
"POLLJOH" <anonymous@discussions.microsoft.com> wrote in message 
news:C41F8F03-EF8B-4A32-9235-27EE38E9F16E@microsoft.com...
> Using ADO from VBA I am running stored procedures in SQL Server 2000 and 
> copying the returned recordset to an Excel ***. The problem is I want to 
> insert the column names also (I do not want to hard code these since I am 
> using a generic wrapper which just accepts the stored procedure name and 
> can be used to run any sproc in the database). I searced all the catalog 
> system stored procedures and although there is a sp_sproc_columns it does 
> not return the column names.
>
> At this stage I am faced with writing a parsing routine which could use 
> sp_HelpText to extract the column names or creating a table with the 
> column names in  but I want to avoid any of these if there is an easier 
> alternative .
>
> Any help would be much appreciated.
>
> Regards
> JOHN
>