This query will return the number of tables in the specified database.
Output is same for all the methods below.
Method 1:
USE AdventureWorks2017 GO SELECT COUNT(*) from INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'
Following is another way this can be done for all user tables.
Method 2:
USE AdventureWorks2017 GO SELECT COUNT(*) FROM sys.tables
Output:
71
Related Article:
- Retrieve information on backup and restore operations in SQL Server
- Return list of SQL Agent jobs with schedule information in SQL Server
- Count the Number of Tables in a Database in SQL Server
- Retrieve List of all Stored Procedures in SQL Server
- Display all data files for all databases with size and growth info in SQL Server
- Get all schemas, tables, columns and indexes in SQL Server
- Retrieve all Table detail from Known Column in SQL Server
- Get the list of all databases on a server in SQL Server
- Show Size of All Tables in Current Database in SQL Server
No comments:
Post a Comment