sql server - Looping for each column name of a MSSQL table using php -
if have [x]
[y]
[z]
columns inside [mytable]
table in mssql, know how can loop through each of them using php in order have of columns' name? reason because potentially delete or add column php code make dynamic without having hardcode php page. basically, if have php code similar following,
foreach( column $columname in [sql table]) echo "$columname"; // else }
it awesome.
select data information_schema.columns system view. filtered on table name.
select column_name information_schema.columns table_name = 'mytable'
returns
column_name ----------- x y z
this gives resultset containing column names, loop through , use values.
Comments
Post a Comment