Monday, February 27, 2012

how can I get the list of tables and views together in the database by the dbconnection.ge

I have tried
SqlConnection.getSchema("Tables"). it returns me a list of all tables while getSchema("Views") returns me the views in the form of DataTable.
But can we have a way to get them together in the same DataTable as a return result? because I want to read the rows by DataTable.CreateDataReader() later.

select

Namefromsysobjectswhere typein('v','u')and status>-1

Will return a list of all the user tables and views.

|||

In SQL Server 2005, you should use system view for the same result.

select * from sys.objects where type in ('v','u')

No comments:

Post a Comment