SHASHANGKA SHEKHAR'S BLOG

Hi, I am Shashangka Shekhar, Working with Microsoft Technologies. This is my personal blog where I share some of my experiences.

Char, Nchar, Varchar & Nvarchar Data Types

CHAR vs VARCHAR

CHAR:

  1. It is a fixed length data type
  2. Used to store non-Unicode characters
  3. Occupiers 1 byte of space for each character

VARCHAR:

  1. It is a variable length data type
  2. Used to store non-Unicode characters
  3. Occupies 1 byte of space for each character

NCHAR vs NVARCHAR

NCHAR

  1. Is a fixed length data type
  2. Used to store Unicode characters (for example the languages Arabic, German and so on)
  3. Occupies 2 bytes of space for each character

NVARCHAR

  1. It is a variable-length data type
  2. Used to store Unicode characters
  3. Occupies 2 bytes of space for each character

Aggregate Functions in SQL Server

Let’s create a SampleDB database fist with SQL Management Studio. Now create a table in SampleDB.

Insert Sample Data:

Aggregate Functions in SQL Server

COUNT (Transact-SQL)

Returns the number of items in a group. COUNT always returns an int data type value. Read More

Table Variables

Temp variable can be created like this:

Table variable is always useful for less data. If the result set returns a large number of records, we need to go for temp table.

Temporary Tables

Types of Temporary Tables
SQL Server provides two types of temp tables based on the behavior and scope of the table. These are:

  1. Local Temp Table
  2. Global Temp Table

Read More

Views In SQL Server

Let’s create a SampleDB database fist with SQL Management Studio. Now we have to create a table in SampleDB.

Let’s Name the table as – Employee

Read More