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
 Parameter Names and Variable names in sprocs

Author  Topic 

SexyChick
Starting Member

6 Posts

Posted - 2010-05-04 : 15:42:30
I recently come across a sproc where the parameter name was shared with a local variable name. They were of the same datatype as well. How would you be able to determine between the 2 which is which? An example is below:



ALTER Procedure [dbo].[usp_Toolkit_Synch_Clinic]

@Clinic_ID as bigint

As

Declare @ClinicID as bigint

.
.
.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-04 : 15:51:14
The two are named differently, so it's easy to differentiate them. Notice one has an underscore and the other doesn't.

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

Subscribe to my blog
Go to Top of Page

SexyChick
Starting Member

6 Posts

Posted - 2010-05-04 : 15:53:43
oops, my mistake.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-04 : 15:53:53


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

Subscribe to my blog
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-05-07 : 09:34:02
quote:
Originally posted by SexyChick

I recently come across a sproc where the parameter name was shared with a local variable name. They were of the same datatype as well. How would you be able to determine between the 2 which is which? An example is below:



ALTER Procedure [dbo].[usp_Toolkit_Synch_Clinic]

@Clinic_ID as bigint

As

Declare @ClinicID as bigint

.
.
.




Note that you can't declare two variables with same name
So there is strong reason that variable names are different

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -