Hi Sergey,
Thank, so
01) I advise developer to use NULL insteads of '' and use default as NULL
for the parameter, is that right ?
02) On the other hand, why is the SP code, if (LEN(@para1) > 0) become true
when @para1 = '' ?. Why ? Currently, i am using if(len(@para1) > 2) to check
for any parameter pass in and if(len(@para1) = 2) to check for empty parameter as changes to my system now is too big a impact.
>I prefer Null as default for aparameter. This way you don't even have to pass parameter in. Checking for null value seems more clean to me then len(@para1).
>
>>Why is it that SP passing in parameter of '' end up with LEN() giving 1
>>in the SP when it is empty('') string ?
>>
>>For example, my sample SP
>>
>>Create store procedure Test(@para1 char(10), @para2 char(10))
><snip>
>>
>>Therefore, what is the best way to pass in a parameter if it is empty, do we set
>>it to NULL for default or pass in NULL if it is empty. Please advise
Best Regards
Virusim