Debugging showing LEN(@i_name) > 0 when @i_name = ''''

  • Hi,

    Below is a simple SP created to stimulate my issue.

    If I run the SP, it is working correctly.

    However, when I debug it in QA, it will print 'Length >0' when I pass '' as input parameters. Why is QA having such a issue which confused me.

    Anyone got any ideal why QA is having this issue. I am using SQL2k

    with SP4

    create procedure dbo.a_123

    (

    @i_name varchar(50)

    )

    as begin

    if(len(@i_name)>0)

    print 'Length > 0'

    else

    print 'Length = 0'

    end

    GO

  • Hmmm ... works fine for me.

    Are you sure you're passing in the correct input?

    Put a print statement to show the @i_name variable before the If .

     

    --------------------
    Colt 45 - the original point and click interface

  • If you pass in a string containing nothing but spaces LEN will return 0.

  • Yes, so by that logic it should print 'Length = 0' ( which it does for me )

    Vladmir's problem is that it's printing 'Length > 0'

    --------------------
    Colt 45 - the original point and click interface

  • If it is doing it during DEBUG I would suggest printing the LEN and the CODE() for the character that is being passed in.

    Clearly DEBUG is translating the space in some way but as to why I don't know. It is something odd on Vladmir's server.

  • Hi,

    Thank everyone, someone point out that my problem and QA limitation.

    One of my debugging tool, show that some of my input parameter is '',

    so I enter '' for that parameter in the debugging mode, it will show

    len(@i_name) > 0.

    Instead, I should be enter space in the debugging mode for that parameter

    or change that parameter in debugging mode.

    HTH

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply