Link to home
Create AccountLog in
Avatar of gotiva
gotiva

asked on

What does @ symbol usually represents within the SQL coding?

I am reviewing SQL coding and I noticed that @ symbol repeats so many times. I am also posting the sample code for you to review.
My question is what is usually represented by @ symbol within SQL.
Thank You, A.

create proc mic_is_in_role
 @RoleName varchar(24) = null,
 @loginId varchar(16) = null
as
--DESCRIPTION: returns 0 if user login id is in role, otherwise returns a value less than 0
set nocount on
 
if (@RoleName is null OR @loginId is null) begin
  return 10201
end  
 
if exists (select *  
           from ncx_roles
           where RoleName = @RoleName
           and LoginId = @loginId) begin
 return 0           -- yes, loginid is in role
 
end else begin
ASKER CERTIFIED SOLUTION
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of powercram
powercram

The @ (at symbol) is equivalent to the START command and is used to run SQL*Plus command scripts.

A single @ symbol runs a script in the current directory (or one specified with a full or relative path, or one that is found in you SQLPATH.

@@ will start a sqlplus script that is in the same directory as the script that called it (relative to the directory of the current script). This is normally used for nested command files.
powercram,

I don't think that applies to MS SQL Server!

TimCottee
Avatar of gotiva

ASKER

Thank You.