Query vs. C# method to retrieve database metadata
问题 I need to retrieve for each table in the database the following info: All columns names For each column its type Type max length The possible way to do that is to run a query (even can execute it using await, i.e. async): select object_NAME(c.object_id), c.name, t.name, c.max_length from sys.columns c INNER JOIN sys.types t ON t.system_type_id = c.system_type_id On the other hand there is GetSchema method on connection which makes the same: DataTable columns = connection.GetSchema