Wednesday, July 6, 2011

Count number of tables, stored procedure, function and views in sql database

Count number of tables, stored procedure, function and views in sql database

To count number of Tables in sql database
SELECT COUNT(*) FROM information_schema.tables WHERE Table_Type = 'Base Table'

To count number of Procedures in sql database
SELECT COUNT(*) FROM information_schema.routines WHERE Routine_Type = 'Procedure' 

To count number of Functions in sql database
SELECT COUNT(*) FROM information_schema.routines WHERE Routine_Type = 'Function' 

To count number of Views in sql database
SELECT COUNT(*) FROM information_schema.views

2 comments:

  1. This is really working.I got my solution also.Thanks alot...

    ReplyDelete
  2. Nice post. Thank you very much.

    ReplyDelete

Note: Only a member of this blog may post a comment.