Collections:
What Is Variable in SQL Server Transact-SQL
What is a variable in SQL Server Transact-SQL?
✍: FYIcenter.com
A variable in Transact-SQL is a symbolic name representing
a memory storage that holds a piece of data.
A variable has the following the components:
1. Variable name - A symbolic name to represent the variable. Variable names in Transact-SQL must starts with the @ character. For example, @count and @price are variable names.
2. Variable data type - A predefined format on how the data is stored in the variable. For example, INTEGER and MONEY are variable types.
3. Variable value - The value represented by the data in variable storage. For example, 3 and 9.99 could be variable values stored in @count and @price variables.
4. Variable scope - The period of execution in which the variable is declared, assigned with a value and required to hold the value.
Here is an example using variables in Transact-SQL in a statement batch:
DECLARE @price MONEY; SET @price = 9.99; PRINT @price;
In the above example:
⇒ List of Data Types in SQL Server Transact-SQL
⇐ Variables and Data Types in SQL Server Transact-SQL
2017-04-22, 2410🔥, 0💬
Popular Posts:
How To Insert New Line Characters into Strings in SQL Server Transact-SQL? If you want to break a st...
How To Create a Dynamic Cursor with the DYNAMIC Option in SQL Server Transact-SQL? If the underlying...
How REAL and FLOAT Literal Values Are Rounded in SQL Server Transact-SQL? By definition, FLOAT(n) sh...
How to set database to be READ_ONLY in SQL Server? Databases in SQL Server have two update options: ...
How To Start the Command-Line SQL*Plus in Oracle? If you Oracle server or client installed on your w...