Use SqlConnection.GetSchema to get only tables (no views)

When i use

SqlConnection.GetSchema("Tables");

it returns all tables and views for the target database.

Is there any way to return tables? All studies show that I'm doing it right, but it always returns views like tables. I dug into a DataTable in debugging, and I can't even find the difference. Data types are reported the same way ... As far as I can tell, it cannot distinguish between a view and a table. (This makes sense since the view for all goals and objectives is a table.)

I am using the Northwind database for testing.

I am writing an application in C #.

Here is the code that I run to get the schema information. Pretty simple.

SQLCon.Open();
DataTable tables = SQLCon.GetSchema("Tables");
SQLCon.Close();

getschema ... .

+2
2

, table_type, , VIEW BASE TABLE.
, #.

+5

DataTable table = connection.GetSchema("Tables", new string[] { null, null, null, "BASE TABLE" });
+3

All Articles