The ‘Database’ Archives
Posted November 26, 2018 by

How To Use STRING_AGG – Concat Multiple Row Values In SQL Server

How To Save Query Execution Plan In SQL Server

Concat multiple row values in SQL Server is a well-known familiar problem. Every database developer happened to write concatenation string queries for reporting or general purpose. Numerous methods including XML PATH, COALESCE function, Recursive CTE been used to achieve desired results.

Category Database, SQL Server

Posted November 25, 2018 by

NULLIF – TSQL Function in SQL Server

How To Save Query Execution Plan In SQL Server

NULLIF is a function applied to return a NULL value if specified two expressions (expression1= expression2) are equal. NULLIF function is an ANSI function, it is available with other RDBMS vendors like ORACLE, MySQL, Postgres and among others. NULLIF Function can be useful in cases when applications are using different indicators to represent a Missing […]

Posted November 23, 2018 by

TRY…CATCH Error & Exception Handling in SQL Server

Implementing acceptable Error Handling logic in T-SQL code is important to avoid unexpected errors breaking the system. Exception Handling using TRY…CATCH block in Microsoft SQL Server is fairly identical to exception handling in .NET and Java programming languages. Basic Fundamental of TRY…CATCH block is a group of statements can be enclosed in a BEGIN TRY…END […]

Posted November 22, 2018 by

How To Get Last Identity Inserted Value In SQL Server

How To Save Query Execution Plan In SQL Server

IDENTITY property in SQL Server creates an identity type column. It generates auto-incrementing values in table by defining seed and increment values, works much like SEQUENCE object in SQL Server and Oracle. However, IDENTITY property is table dependent and SEQUENCE object works independently from the table.

Category Database, SQL Server

Posted November 18, 2018 by

How To Use DROP IF EXISTS in SQL Server

How To Save Query Execution Plan In SQL Server

SQL Server 2016 edition has included an awe-inspiring feature in Database engine that is DROP IF EXISTS along with a bunch of superior features. Option DROP IF EXISTS is used when we need to verify if an object exists in a database before creating/ dropping it. In this situation, we need to first drop existing […]

Posted September 24, 2018 by

Top 6 Free MySQL Hosting Services – Give Your Wallet a break


Nowadays, you barely see a PHP driven website that doesn’t store its data with a MySQL database. Released in 1995 (first version), this open-source database management system has turned into a crucial part of a website. Perhaps, this is the one major reason, many webmasters look for free MySQL hosting. If you’re one of them, […]

Category Database, Hosting

Posted June 26, 2017 by

Performance Tip: Avoid Using the SP_ Prefix in Stored Procedures

How To Save Query Execution Plan In SQL Server

Database developers often name stored procedures with the SP_ prefix in SQL Server. The SP_ prefix helps other developers quickly identify an object as a stored procedure. Although there have been many debates over whether or not user created objects should be named with the sp_ prefix following the naming convention standards, we should not […]

Posted June 20, 2017 by

Execute WITH RESULT SETS Feature in SQL Server

How To Save Query Execution Plan In SQL Server

With the introduction of SQL Server 2012, a useful feature was included: EXECUTE WITH RESULT SETS. This feature allows us to modify the column names and column data types of the result sets returned by a stored procedure without actually modifying the stored procedure code.

Posted June 5, 2017 by

Creating an Index with DROP_EXISTING = ON in SQL Server

Creating an index in SQL Server is a moderately simple task that improves the query performance. We can create a clustered as well as a non-clustered index which can be either unique or non-unique as per requirement.

Posted May 29, 2017 by

How to Use the TRY_CAST Function in SQL Server

How To Save Query Execution Plan In SQL Server

The TRY_CAST function in SQL Server is used to cast value from its existing data type to a specified target data type. This occurs only if the operation is successful. It returns NULL if the conversion fails. TRY_CAST is an extended version of the CAST function. This tutorial explains how to use TRY_CAST in SQL […]

Posted March 6, 2017 by


The ANSI_NULLS database SET option controls the behavior of Equal (=) and comparison operators (!=) in queries while dealing with NULL records. It is an ISO standard to decide for a query action to conclude how SQL Server should handle the comparison with NULLs.

Posted February 28, 2017 by


How To Save Query Execution Plan In SQL Server

How often do we think of NULL values while concatenating NULLs with string values? String concentration with NULL values can give us some unexpected results if we are not aware of CONCAT_NULL_YIELDS_NULL database SET options. CONCAT_NULL_YIELDS_NULL options control whether concatenation results shall be treated as NULL or empty string values.