Wednesday, November 16, 2011

How to list the user tables in the database?


The following method can be used to get the list of user tables in the sql server.
Method 1 : SELECT name FROM SYS.OBJECTS WHERE type=’U’
Method 2 : SELECT NAME FROM SYSOBJECTS WHERE xtype=’U’
Method 3 : SELECT name FROM SYS.TABLES
Method 4 : SELECT name FROM SYS.ALL_OBJECTS WHERE type=’U’
Method 5 : SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE=’BASE
TABLE’
Method 6 : SP_TABLES