Category: Scripts

  • Find Indexed column details in a database

    I was looking for a script to find out the indexed column details as part of our migration. I tried to use sp_helpindex however it requires a object name which means you can find details for only one table at a time. My requirement is to get details about all indexed columns across the database…

  • Script to get data file usage and autogrowth details

    I’ve wrote this script to get data file allocated and used space. In addition to this I’ve also added auto growth setting details for the data file. Written two scripts for fetching the details, first one will get you the details for one database and second one will give you the details for all the…

  • Script to Retrieve Security Information – SQL Server 2012 (Denali) and above

    SQL Server 2012 codenamed SQL Server Denali is on the way to market by 2012. As you all know SQL Server 2012 has new features related to security, we have contained database where you are allowed to create contained users and the next feature is server level roles, other security features are not related to…

  • Startup procedure to check SQL Server status when restarted

    I’ve written a startup procedure to check SQL Server status when the SQL Server gets restarted. Most of the time as a DBA when a Server gets rebooted or SQL Services is restarted we need to make sure everything is fine in SQL server to make sure SQL server is running healthy. Some companies will…

  • Database Documentation

    Almost every application DBA would have a need to document the various database objects such as tables, views, stored procedures and functions. I wasn’t an exception and exploring ways to document the 400+ tables we have. Basically, this would serve the following purpose: