Parameter size

  • Thread starter Thread starter Jon
  • Start date Start date
J

Jon

If I specify a type of parameter as varchar or decimal, etc, is there a time
when you are required to specify the size of that param as well. Or is it
safe to simply specify name, direction, type and value? To this point I
have used that and it works fine, but I'm wondering if I may be asking
trouble somewhere down the line. Thanks
 
Jon, what I have noticed is that if you specify the size in the parameter,
then you also have to specify the size in the stored procedure ... or you
will have problems. Safest course is to specify them in both locations. I
too have sometimes created parameters without the size, but inevitably it
has come back to haunt me.
 
It's not necessary to pass in size. It just saves the database a small
amount of work.

In any case, the parameter is only meaningful for variable size fields
like varchar. I understand that it's ignored for fixed-width
datatypes. If you have to pass it in in these cases, for example when
you want to specify parameter direction, and the method signature
requires that size be specified as well, you can just give the size
of the datatype, e.g. len(int32).

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 
Back
Top