From the category archives:

SQL Server Scripts

How to find tables without Primary Key?

Thumbnail image for How to find tables without Primary Key? November 16, 2012

We all know that for better performance, every table should have a primary key.  Here is a short script that will enlist all the tables in a database which do not have a primary key :- Once you have the tables without primary keys, you can decide on the possible candidates for creating a primary [...]

0 comments Read the full article →

A way to set execute permissions on all stored procedures in a SQL Server database

Thumbnail image for A way to set execute permissions on all stored procedures in a SQL Server database November 15, 2012

Very often, we need to grant execute permissions on all SP (Stored Procedures) in a SQL Server Databases. Below is a sample script to get this done for all SP in a databases. This method will grant EXECUTE permission on existing SPs only. A new user defined database role can be created and it can [...]

0 comments Read the full article →

Find lead blocker on a SQL Server Instance

Thumbnail image for Find lead blocker on a SQL Server Instance December 26, 2011

When database server is experiencing slowness one of the very first things we check are blocks. Blocking can be described as Blocking is an unavoidable characteristic of any relational database management system (RDBMS) with lock-based concurrency. On SQL Server, blocking occurs when one SPID holds a lock on a specific resource and a second SPID [...]

1 comment Read the full article →

Extract Object Level Permissions from a Database

Thumbnail image for Extract Object Level Permissions from a Database December 25, 2011

Database restoration is a very generic task which DBAs encounter on a daily basis. Be it restoration of a DEV copy from a prod one or creaing new TEST/QA/UAT environment. Many time such requests require a database to be overwritten by a some backup. In such cases its extremely important to make sure that the [...]

0 comments Read the full article →

Get size of all databases in MB | SQL Server

Thumbnail image for Get size of all databases in MB | SQL Server December 23, 2011

Many times during our day to day operations, a DBA needs to gather info regarding databases that is easy to get for a single database but for multiple database it become s abit of challenge. One similar thing is getting database sizes of all databases on a SQL Server . For a single database sp_helpdb [...]

0 comments Read the full article →