Solved

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

Posted on 2006-06-27
4
203 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
  • 2
  • 2
4 Comments
 
LVL 142

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 142

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
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…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

707 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now