When passing parameters to MS SQL Server Stored Procs, do we send values or pointers?
Posted on 2006-06-27
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.