[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2006-06-27
4
Medium Priority
?
211 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

656 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