Many times we want to know How many Tables we using in our Database.Here I have written the query to find the total number of tables/columns used in Database.
SELECT COUNT(*) FROM SYSOBJECTS WHERE XTYPE = 'U'
Here U is used for Tables.This Query return TotalNumber of Tables present in the Database.If We want to Know the total column name in whole Database then used following Query
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
This Query returns the total number of tables present in the Database.If We want to know all the column names,then use the following query:
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
Hope It will Help to all.