I have to use OLE DB with an SQL Server CE. My task is to obtain the metadata on all the columns in a table.
One way to do it is select all the fields of any row and then obtain IColumnInfo from the resulting row set. However, this is done at the cost of selecting a row.
My question – is it the fastest way or is there a better way to get hold on the DBCOLUMNINFO objects for all the columns in a table?
If you want to avoid selecting rows, use
where 1 = 0as your where clause.You could also use the INFORMATION_SCHEMA tables.
Microsoft docs: Information Schema (SQL Server Compact)