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

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.

johnhydeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
yes
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
> 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
 
johnhydeAuthor Commented:
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
 
johnhydeAuthor Commented:
That's what I wanted to know - many thanks for the speedy response.
0
All Courses

From novice to tech pro — start learning today.