Getting table schema from a query

前端 未结 5 502

As per MSDN, SqlDataReader.GetSchemaTable returns column metadata for the query executed. I am wondering is there a similar method that will give table metadata

5条回答
  •  佛祖请我去吃肉
    2021-01-12 12:55

    I think Rob Farley's showplan xml will work for you (assuming you are running a late enough SQL Server that has this feature).

    Each column seems to have for each of the selected columns. Assuming you have at least one column from each table, it should be trivial to make a mapping between alias and table.

提交回复
热议问题