Microsoft SQL Server/Variables

Declaration and affectation
Every variable name begins with an at.


 * Integer operations:


 * Character operations:

Types
The possible variable types are similar to the table fields ones :

Characters
Those beginning by "n" are in format.

char, nchar, nvarchar, ntext, text, varchar.

To save a few memory space, it's possible to set a characters number limit during the declaration: varchar(255) The variable of characters maximum size is 2 GB : varchar(MAX)

Numbers
decimal, int (tinyint, smallint, bigint), float, money, numeric, real, smallmoney.

Dates
date, datetime, datetime2, datetimeoffset, smalldatetime, time.

Personalized types
In addition to the native types, it's possible to create one's own data types with.

Type determination
The function  returns a given field type. Example: