James Newtons Massmind wrote: >>> I know this should be obvious, and I have googled, but how does one >>> get a list of columns in an SQL table? In this case, I am writing a >>> script that needs to add data from a form to any of several >>> >> different >> >>> tables where the columns in the tables may be changed by the users >>> without them having to (or being able to) update the script. >>> >> This works in MySQL but I don't know enough to confirm that >> it will work in MSSQL. >> >> show columns from tablename; >> > > > The wonderfull thing about standards: There are so many to choose from... > Thanks anyway, but that syntax fails in MS SQL. > > --- > James. > > "SHOW" is a mysql specific extension to the "standard", mysql was hammered for having all that kind of stuff and none of the other fiddly bits for ages ;-> Querying the information schema (the DBC.columns type query) should be the quick and simple way to do it. I have done something like that in sybase 95 or something similar (a few months ago, dammit people UPDATE!) but I can't remember off the top of my head the specifics on how to do it. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist