Link to home
Start Free TrialLog in
Avatar of ZURINET
ZURINET

asked on

Search Error

Hi all
I have a code snippet below used to search for values in table

I am having problem with searching for values with 00 as string
why would the query be returning only the first records set and not the rest of 100's


The command is run withing the store procedure

set @sql_where        = ' and (Table.F0ArtNr like '''+@strSuchStr+''')'

The where statement goes    =    where        Table.F0ArtNr like @strSuchStr

and
 

if substring(@strSuchStr,1,1) = '?'
            begin
            set @sZahl = substring(@strSuchStr,2,len(@strSuchStr))
            end
        else
            begin
            set @sZahl = @strSuchStr
            end
   
        if isnumeric(substring(@sZahl,1,6)) = 1
            begin
            set @iSearchArtNr = 1
            end
        else
            begin
            set @iSearchArtNr = 0
            end
 
        set @strSuchStr = upper(ltrim(rtrim(@strSuchStr)))+'%'
 
 
        if substring(@strSuchStr,1,1) = '?'
            begin
            set @strSuchStr = '%'+substring(@strSuchStr,2,len(@strSuchStr))
            end

Open in new window

Avatar of momi_sabag
momi_sabag
Flag of United States of America image

i didn't understand your problem
Avatar of ZURINET
ZURINET

ASKER

Hi

Would any of the set @strSuchStr = '%'+substring(@strSuchStr,2,len(@strSuchStr))
construct be removing 00 in a string

That is if I decide to search for 000999
would the substring be removing the 00 in the string?
ASKER CERTIFIED SOLUTION
Avatar of momi_sabag
momi_sabag
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ZURINET

ASKER

What I know is that one of this substring is removing all the 0 digits if the search string starts with 0
Avatar of ZURINET

ASKER

Will run a test in console and find out which on is doing this