Click to See Complete Forum and Search --> : Reading Column Names in VB script


November 3rd, 1999, 09:24 AM
My database is in MS Sql Server 7.0. How can I return the name of the column in a table so that I can use it processing. I have no problems accessing the data using the column names but I would like to have the column name returned instead of the data.

Lothar Haensler
November 3rd, 1999, 09:34 AM
the sp_columns system stored procedure returns the column information for all columns of a table.
Execute it ("exec sp_columns 'yourtable'") and find the column namens in the first field of the recordset.