Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Difference between Parameters and Variables

Author  Topic 

jrobin747
Starting Member

48 Posts

Posted - 2013-08-26 : 17:28:54
I don't know the difference between parameters and variables in a stored procedure. How can I tell?

ALTER PROCEDURE [dbo].[spEdgeSalesDashBoad]
@x_strSessionGUID VARCHAR(50),
@x_strStartofWeek VARCHAR(10),
@x_StartofMonth VARCHAR(10),
@x_strEndDate VARCHAR(10)

AS
BEGIN
SET NOCOUNT ON;

DECLARE @strStartofWeek VARCHAR(10), @strStartofMonth VARCHAR(10),
@strEndDate VARCHAR(10),
@strCurrentMonth VARCHAR(10),
@strCurrentYear VARCHAR(10)

SET @strStartofWeek=(SELECT CONVERT(varchar(10), DATEADD(day, -7, GETDATE()), 101))
SET @strCurrentMonth=MONTH (GETDATE ())
SET @strCurrentYear=YEAR (GETDATE ())
SET @strStartofMonth=(@strCurrentMonth + '/01/' + @strCurrentYear)
SET @strEndDate=GETDATE ()

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2013-08-26 : 17:42:51
Everything before the "AS" are input parameters. You could have output parameters there too.

They are all variables. If they start with @, then it's a variable.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jrobin747
Starting Member

48 Posts

Posted - 2013-08-26 : 17:50:43
thanks I thought so
Go to Top of Page
   

- Advertisement -