I'm trying to find a way using a straightforward SQL command (in VBScript to a SQL 2000 db through an ASP application - all legacy stuff) to count the numer of columns (fields) in a table then return the field names. Any suggestions? I've scoured the literature available in McSoft, and the only way that comes close is using a view, which is way too convoluted.
You can use the built-in INFORMATION_SCHEMA view. I don't have the exact syntax, but something like SELECT COLUMN_NAME FROM INFORMATION_SCHEMA WHERE TABLE_NAME = 'myTable'
You can get all the properties of the db structure.