SQL Server Accidental DBA

SQL Server new query window shortcut

Shortcuts help you to do your work swiftly and with increased productivity. In this blog we’ll look at new query window shortcut every SQL Server geek should know Shortcut Usage Window …
Read More »

SQL Server error message 3159

One of my friends working on SQL Server 2000 to 2005 faced following issue. Msg 3159, Level 16, State 1, Line 1 The tail of the log for the database “databasename” …
Read More »

SQL function to get weekday - weekly calendar

In this blog post we’ll look at a way to list out all week days of a week a particular date belongs too. This can be even referred to as weekly …
Read More »

Insert multiple rows using single Insert statement in SQL Server

This is a very basic problem sometimes newbies struggle with. I have seen developers writing 10 different insert statements to insert 10 rows in a table.  This can be simplified in …
Read More »

Constraint to limit VARCHAR max character length in SQL Server

A business need may arise to limit a VARCHAR column to a certain length. Consider a scenario where in an application has a 10000 character limit for a column. The VARCHAR(max) …
Read More »

SQL Server unattended installation 2014

SQL Server unattended installation or silent installation can be done using the configuration.ini file. The SQL Server installation GUI application saves the setup instructions in a configuration.ini file which it further uses …
Read More »

Primary Key and Unique Key difference in SQL Server

Primary and Unique Key both enforce uniqueness of columns on which they are defined. Then where do they differ? They differ in following way –          A primary key doesn’t allow null …
Read More »

Locking hints SQL Server

Locking hints are used with SELECT/INSERTS/UPDATE/DELETE statements to enforce or change the default locking behavior.  Given below are some of the locking hints available in SQL Server ROWLOCK The ROWLOCK hint …
Read More »

Difference between UNION and UNION ALL in SQL Server

Difference between UNION and UNION ALL is one of the most asked interview question. UNION and UNION ALL both combine result set from two or more queries into single result. The …
Read More »

Detach or take offline in SQL Server

Detach or take offline both causes a database to be inaccessible to users. The difference is that detach deletes database metadata from SQL Server i.e. database file information, status information and …
Read More »

Copy Column Headers in SQL Server

Copy column headers in query result window seems an easy task however, it can be a nightmare for amateurs. There is no visible instruction/link/button where in one can click and copy …
Read More »

SQL Server Replication Terminology

SQL Server Replication is a way to automate data distribution from a source to one or more destination database. SQL Server replication follows the Magazine Publishing terminology. A publisher (source instance) …
Read More »

SQL Server indexed view limitations

A SQL Server View is logical database object made up of a SQL Statement. It can also be called a virtual table made up of a SQL statement which may have …
Read More »

SQL Server Error Message 1101 - Insufficient Disk Space

The SQL Server Error Message 1101 occurs when a database runs out of space. The error message is given below. ERROR 1101: Could not allocate a new page for database because …
Read More »

Disable and Enable triggers in SQL Server

A DML trigger is a set of SQL statements which are executed when a DML (Insert/Update/Delete) event occurs in a database. A DDL trigger is set of SQL statements executed when …
Read More »

SET vs SELECT in SQL Server

SET vs SELECT is a common topic of discussion among SQL geeks and one of the most asked interview question. SET is used to assign a value to a variable and …
Read More »

SET ROWCOUNT in SQL Server

The SET ROWCOUNT limits the result set to the number of rows specified. The SQL Server stops the query processing once the specified number of rows are reached. The ROWCOUNT effects …
Read More »

Find nth max value in SQL Server

One of the most commonly asked interview question is to find nth max value in SQL Server. There are multiple solutions to this question. The below query creates a dummy table …
Read More »

Enable CLR in SQL Server

The Common language runtime (CLR) feature allows you to write stored procedures/trigger/functions in .NET managed code and execute the same from SQL Server. However, in order to enable the execution of …
Read More »

Case sensitive search in SQL Server

Yes, a SQL Server database can be case sensitive. Case sensitive here means that SQL Server will return different result set for CASE, Case, CaSe etc. and it will treat the …
Read More »

Older Entries »

One Comment on “SQL Server Accidental DBA”

Leave a Reply

Your email address will not be published. Required fields are marked *