Details of all databases in an Instance

Posted by Bandi under Sql Server category on | Points: 40 | Views : 765
we can replace below SQL with the help of sp_Helpfile and MS_foreachDB

sys.master_files contains a row per file of a database as stored in the master database
The minimum permissions that are required to see the corresponding row are CREATE DATABASE, ALTER ANY DATABASE, or VIEW ANY DEFINITION

select distinct @@Servername AS Server ,
name AS DatabaseName ,
File_id ,
state_desc DBStatus,
size SpaceUSed,
growth GrowthPercentage
from sys.master_files

Comments or Responses

Login to post response