Powered by Blogger.

Saturday, February 15, 2014

Get all user defined tables in SQL Server 2008



In this post we will discuss how to get all user defined tables in sql server 2008.

You can also check my previous posts on Some Optimization Tips in sql server, Left outer join and Right outer join in SQL Server and Difference between clustered index and non clustered index in sql server 2008.

Below is the query that will retrieve user defined tables from the database.

SELECT name AS [TableName] FROM sys.objects where type_desc = 'USER_TABLE'

OR

SELECT name FROM sys.objects WHERE type = 'u'

See the figure for output:



Similarly you can also get the modified date like below:

SELECT name AS [TableName],modify_date as [ModifyDate] FROM sys.objects where type_desc = 'USER_TABLE'



0 comments

Post a Comment