Re: Getting Field Names in Microsoft SQL

From: Date: Sun, 18 Aug 2002 14:57:00 +0000
Subject: Re: Getting Field Names in Microsoft SQL
Groups: php.windows 
Request: Send a blank email to php-windows+get-15334@lists.php.net to get a copy of this message
The "select * from [tablename]" approach for MS SQL may be problematic if you have very large tables even if you only return one row. You don't have an accessible index for "select *". It also gives you no information about table data types. That's why I suggested using a "select [name] from syscolumns where id = [your_table_id]". If you are using MS SQL, you've already made a platform choice (or had it jammed down your throat), and I don't believe that one select statement determines portability. It all depends on your requirements. Dave -----Original Message----- From: Brad Thomas [mailto:alarum@bigpond.net.au] Sent: Friday, August 16, 2002 9:35 PM To: php-windows@lists.php.net Subject: [PHP-WIN] Re: Getting Field Names in Microsoft SQL "R.S. Herhuth" <ronherhuth@pop.mindspring.com> wrote in message news:3D5CA43A.FF39E808@pop.mindspring.com... > > I'm trying to build a dynamic script that basically extracts all of the > fields in a MS SQL database...I just can't seem to figure out how to get > at the field names themselves. I am using the mssql_fetch_array > followed by the $row['field_name'] in an array. But I would like to > make the field_name dynamic (i.e. not knowing the field_names ahead of > time) which would make the script adaptable to any table in the > database. So if I get the field's value by $row['field_name'] how do I > get at the field's name? > > thanks, > Ron

« previous php.windows (#15334) next »