Category: Scripts

  • 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:

  • Script to Check SQL Server Connectivity

    Use this VB script to check SQL Server connectivity. You can add N number of SQL Server instances to verify its status.

  • Recent Objects – Without Triggers

    I was thinking about writing a script to capture the objects that were either CREATED/DELETED or MODIFIED in the last 24hrs. Instead of directly querying the sys.objects I from where I can only get minimal information I decided to get a whole bunch of useful information using the SQL Server default trace. By default the…

  • Attach all user databases

    I was doing an upgrade of one of our development servers to SQL Server 2008. To minimize the downtime I decided to attach all the user databases using script. Basically, I am attaching the db from the same location there were present earlier to being detached. Consider the following example, If I have a database…

  • Capture SQL Performance Counters through TSQL

    Performance counters are useful to gather information about server status and we can analyze the server status later using these data. In my environment one of my client is not ready to pay or buy metrics tools (normally we will be using BMC, HP etc). Our windows team has written they own custom scripts to…