Reputation: 1046
Untill now I have never specified the parameters size when calling a procedure with parameters. But suddenly one day i got an error:
String[2]: the Size property has an invalid size of 0.
I have never seen that before, and it only accured in an output param. So my question is when do I need to size a param, because it works fine as an input..
And, About Output and Output/Input. I have a parameter set as:
@HtmlImageType VARCHAR(30) OUTPUT
But when I look at the table parameters It is classified as Input/Output, and in my C# code it only works with Output.
Upvotes: 1
Views: 657
Reputation: 67898
But when I look at the table parameters It is classified as Input/Output
That's because you do in fact send in a parameter that can be changed in the procedure and that value persisted to the caller, an out parameter.
So my question is when do I need to size a param, because it works fine as an input
You need to size them at all times because the type is variable, VARCHAR
. However, when providing a value as an input
the size is inferred. As an out
it can't infer that size and so the default is 0
.
Upvotes: 1