Solved

When passing parameters to MS SQL Server Stored Procs, do we send values or pointers?

Posted on 2006-06-27
4
208 Views
Last Modified: 2012-05-05
A theoretical question, having spotted an inconsistency while reviewing someone's code:

If I pass a Smallint variable to a stored procedure as a parameter, and the parameter is defined in the stored procedure as an Interger, can this cause problems?

I suspect that an implicit conversion is done for me, but it occurred to me that if SQL handles this by passing a pointer to the variable (as when passing variables using "ByRef" in Visual Basic), the stored procedure could decide to pick up the four bytes following the pointer and end up with the wrong value in the parameter.

Thanks for taking the time to read this.

0
Comment
Question by:johnhyde
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16993186
> can this cause problems?
yes it can, if the parameter is of type OUTPUT and a value larger than smallint is returned.

regarding the value passed into the proc, there is no issue
0
 

Author Comment

by:johnhyde
ID: 16993634
Thanks for this, angelIII.

Certaily no argument regarding OUTPUT parameters.  So is it the case that values, rather than pointers are passed, and SQL Server implicitly converts where necessary?
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 16993739
yes
0
 

Author Comment

by:johnhyde
ID: 16994030
That's what I wanted to know - many thanks for the speedy response.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question