T-SQL 101: 97 Defining and initializing variables in T-SQL
Variables in T-SQL work very much the way they do in other languages. A variable really is nothing more than a name given to a memory location. In T-SQL, variable names must start with an @ sign. An example would be:
@CustomerName
As well as defining a name, variables have other properties.
The first is that we have a data type. It defines the types of things, like strings or numbers and so on, that can we store in that location.
2025-01-24