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
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
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
powercram,
I don't think that applies to MS SQL Server!
TimCottee
I don't think that applies to MS SQL Server!
TimCottee
ASKER
Thank You.
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.