Showing posts with label views. Show all posts
Showing posts with label views. Show all posts

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')

Sunday, February 19, 2012

How can I get a list of all objects accessible by a login using sys* tables

How can I get a list of all objects (like tables, views, stored procedures, etc) accessible by a login (user), or vice versa?

The question has been answered in this thread located in the SMO section of the forum.