http://qs1969.pair.com?node_id=580248


in reply to What is similar in mssql to $dbh->listfields($tbl) in mysql

You can use the following query to get the columns in a table from MS SQL Server:

select syscolumns.name from syscolumns join sysobjects on sysobjects.id = syscolumns.id where sysobjects.name = ?
(you supply the table name as the argument to execute to provide the data for the placeholder.

Alternatively you can use the INFORMATION_SCHEMA view which basically does the same thing:

select COLUMN_NAME from information_schema.columns where table_name = ?

/J\