Jump to content
kori

if in data "-" sign sql select not found

Recommended Posts

Hi!

if in data "-" sign sql select not found. -   

 select * from invoice where accnum='19-00/09598'  

in table 3 record contain '19-00/09598'  but found 0

the accnum field incoming data different formats but   save in the string field

suggestion of soultion ?

sorry my english :-)

Thanks

Share this post


Link to post
Share on other sites

check for unseen extra white spacing either end, as you may be searching for string  containing '19-00/09598' but it could be ' 19-00/09598', '19-00/09598 ' or ' 19-00/09598 ', if you did not trim any spaces before saving to database.

Edited by dsonesuk

Share this post


Link to post
Share on other sites

You can try using 

select * from invoice where accnum like '%19-00/09598%'  

or

select * from invoice where  LTRIM(RTRIM(accnum)) = '19-00/09598'  

 

Share this post


Link to post
Share on other sites

If only there was a way to trim both left and right spacing without using both LTRIM() and RTRIM...WAIT! There is! ItsTRIM().

Edited by dsonesuk

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...