Web Analytics Made Easy - Statcounter

SQL SERVER – Data types

Data types in SQL Server In relational database, we store data in tabular form where data is divided into columns. Each column has a name and a data type which shows what type of data is going to store in that column. Below are the data types which are mostly used in SQL server.CHARACTER(n)    Character … Read more

SQL Server – Convert() function

Convert () function in SQL Server Convert () function is used to convert an expression from one data type to another data typeSyntax for CONVERT function CONVERT ( data_type [ ( length ) ] , expression [ , style ] ) Convert functions is usually used with date/time data type to convert a date in different formats. Below examples will … Read more

IN clause in SQL Server

blank

With IN clause, we can specify multiple values in a WHERE clause. For example, in case of “IN”, one can use the subquery to get the multiple values in the IN clause or we can have predefined values. In this article, we are going to use the following table for some examples:-CREATE TABLE [dbo]. [Employee]([Empid] … Read more

While loop in SQL server

While loop in SQL server

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

Case Statement/ Expression in SQL Server

blank

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 where … Read more

Boyce – Codd Normal Form (BCNF)

blank

Boyce – Codd Normal Form (BCNF)  :- A normal form is said to be a Boyce – Codd Normal Form if it is in 3NF and there is not a possibility of a key attribute is determined by a Non Key attribute. For example , suppose there are 5 columns says A,B,C,D,E and  combination of the columns  A and … Read more

Adding , Deleting and Updating a Column in a table

blank

Many times we need to alter the table definition by adding , deleting or updating a column in the table. In this article, I am trying to explain the following :- 1. How to add a column 2. How to update a column 3. How to drop a column Suppose we have a table say … Read more

SQL Server-Table Variable

blank

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

SQL Server – Local temporary table

blank

Local temporary table:- Local temporary table is created in the tempdb and it is visible to the current user’s session only. It remains exists till the current user session is connected. Once the user connection is disconnected it gets destroyed. Since the local temporary table is created in the tempdb, whenever we use temporary tables … Read more

SQL Server – Global temporary tables

blank

Global temporary table:- Global temporary table is created in the tempdb  and it is visible to all other sessions as well. Global temporary tables are only destroyed when the current user disconnected and all the sessions referring to it closed. It means no user sessions refers it. Since the global temporary table is created in the tempdb, whenever we … Read more