Category Archives: SQL Basic Concepts

SQL Basic Concepts

While loop in SQL server

By | January 1, 2014

While loop in SQL server Introduction In While loop, we set a condition for the repeated execution of a Code block. So we use while loop in SQL Server to repeat execution of a SQL Code block or a SQL Statement till the condition in the while loop is satisfied. Once the condition is failed, the… Read More »

Stuff VS Replace function in SQL Server

By | November 25, 2013

Stuff function: – This function is used to replace string from the given start position, passed as 2nd argument with string passed as last argument. In Stuff function, 3rd argument defines the number of characters which are going to be replaced.   Syntax:- STUFF ( character_expression , start , length , replaceWith_expression ) For example:-… Read More »

Case Statement/ Expression in SQL Server

By | November 25, 2013

Case Statement/ Expression in SQL server    Sometimes we need to get one result output from multiple possible outcomes based on the evaluation of some expression. This expression can be a simple case expression which compares an expression with a set of Expression/Values to determine the result or it can be a search case expression… Read More »

SQL Server-Table Variable

By | January 10, 2012

Table variable:- SQL Server provides an variable known as table variable which is used to store data in a similar way as we store data in physical tables but with some limitations. Like other SQL variable, it is also declare with the help of the Declare keyword with @ prefix. The Syntax of declaring a table variable is… Read More »

How to rename a Table in Sql Server

By | January 2, 2012

To rename a column in a SQL Table following command can be reused: SP_RENAME  ‘old table name’, ‘New table name’ For example, if we want to rename the table from employee to employeemaster, following command can be used. SP_RENAME  ’employee’, ’employeemaster’ This command will rename the table from employee to employeemaster.