SQL - DataTypes - Varchar

VarChar is used to hold a string of characters. It is a variable length string. The maximum length is 8000 characters.

example of creating a table with a VarChar column:

1
2
3
4
5
CREATE TABLE dbo.MyTable ( 
Name VARCHAR(50) NOT NULL,
Address VARCHAR(50)
);
go

In this case we created a table with two columns. The first column is a VarChar column with a maximum length of 50 characters. The second column is a VarChar column with a maximum length of 50 characters.

Substring

SUBSTRING ( expression, start, length )

Start is 1 based