I am trying to use ADODB to work with a MS SQL database containing views.
MetaColumns()
works well with tables, but returns an empty array when I use a view name as the parameter. Further research shows that $metaColumnsSQL
uses sys.tables
object for resolving column names, so it doesn't appear to be intended for views. Is there a way to obtain column names for a view object?
MetaColumns() for a MS SQL view?
140 Views Asked by Vladimir V At
1
ADOdb cannot provide a metaColumns() object for a view because it's basis is the interrogation of the schema for the objects associated with a single table.
You can emulate metaColumns() with a view by using the fetchField() method as follows, using NorthWind:
This would return an array of ADOfieldObjects with basic information about each column:
Unfortunately, the data returned from fetchfield() is not as detailed as from metaColumns but it may be sufficient for your needs.