Site icon Database Tutorials

Declare Variables in SQL Server(TSQL)

 

In this article I will describe how to declare variables in TSQL. We can declare variables in a few different ways.

• Declare a single variable

• Declare multiple variables at once

• Set values when declaring variables

• Set values when declaring multiple variables at once

Declaring g a single variable:

We can set a value as follows to this variable.

Declare multiple variables at once:

Set values when declaring variables:

Set values when declaring multiple variables at once:

 

Exit mobile version