What does the @ symbol do in SQL?
The @CustID means it's a parameter that you will supply a value for later in your code. This is the best way of protecting against SQL injection. Create your query using parameters, rather than concatenating strings and variables. The database engine puts the parameter value into where the placeholder is, and there is zero chance for SQL injection.
SQL Server : what does the '@@' symbol do?
local variables which begins with single @ prefix, The scope of a variable is the range of Transact-SQL statements that can reference the variable. The scope of a variable lasts from the point it is declared until the end of the batch or stored procedure in which it is declared.
Global variables which begins with @@ prefix, you do not need to declare them, since the server constantly maintains them, they are system-defined functions not variables and do not have the same behaviors as variables. All the global variables represent information specific to the server or a current user sessions. Some of the commonly used ones are @@ERROR, @@IDENTITY, @@VERSION.
Update:
Declaring any variable with @@ prefix (except the system-defined) is actually a local variable.
Meaning of the Symbol @@ in SQL Server
In SQL Server, symbol @@
is prefixed to global variables.
The server maintains all the global variables. We cannot declare them.
SQL $ symbol usage
There's no special functionality to the $
character.
The v$
views are public synonyms of Oracle's dynamic performance views. They are given these "unconventional" names to make them easy to recognize.
What is the meaning of '@' symbol in Oracle SQL?
It refers to a non-local table, the bit behind the @ is the db descriptor.
select * from question_answer@abcd where id = '45'
Means select not from the local question_answer
table, but from the table on the db designated as abcd
. The keyword to google for is dblink
What does the @ symbol means on a Procedure in MySQL?
The @
makes it a user defined session variable. Otherwise it would be locally scoped variable (in a stored procedure), you would have to DEFINE
your local before you can SET
it. You could also set a global system variable (with SET GLOBAL
or SET @@global
) if you wanted to. As well as a session system variable with SET SESSION var
or SET @@session var
or SET @@var
.
More details about SET
from the documentation: If no modifier is present, SET
changes the session variable (that's why you DEFINE
your locals in the stored procedure first). If you set several system variables, the most recent GLOBAL
or SESSION
modifier in the statement is used for following variables that have no modifier specified.
More (and some good examples) here:
- MySQL: @variable vs. variable. Whats the difference?
- Variables in Stored Programs
Related Topics
Postgres Analogue to Cross Apply in SQL Server
Join Comma Delimited Data Column
SQL Server Like Containing Bracket Characters
Why Is Using '*' to Build a View Bad
Remove Duplicates Using Only a MySQL Query
SQL Server: Should I Use Information_Schema Tables Over Sys Tables
What's the Difference Between "Where" Clause and "On" Clause When Table Left Join
What Is the Null Character Literal in Tsql
How to See Active SQL Server Connections
How to Version Your Database Schema
Extract Date (Yyyy/Mm/Dd) from a Timestamp in Postgresql
How Can a Left Outer Join Return More Records Than Exist in the Left Table
What Does the Colon Sign ":" Do in a SQL Query
Ssis Package Not Wanting to Fetch Metadata of Temporary Table
Execute Stored Procedure from a Function
Use Email Address as Primary Key