Compare String

  • Hello

    I had tried but don't work I had check there is data same but not showing

  • As Alvin said, one of the strings has an extra "4" in the middle; if the texts are lined up, it's easy to see.

    select * from Gl_code_data where Gl_code='602-43335_Planning - Expedited Air'

    I have Gl_code='602-434345_Planning - Expedited Air' this record in table but result show me nothing

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Yes I also try it but show me nothing if string has space then it not show the result

  • meerack11 (6/19/2015)


    Yes I also try it but show me nothing if string has space then it not show the result

    and that would be normal. equal means equal, not kinda sorta the same.

    you have to define the rules for kinda sorta the same.

    if your data varies by whitespace, you you might need to strip out the whitespace in both the source and the search term in order to compare.

    if

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Okay, I must not have spoken clear enough. Please reread my earlier post with the two steps I said you should take to help us help you.

    I will even repeat them here:

    Step 1: Read this article: http://www.sqlservercentral.com/articles/Best+Practices/61537/

    Step 2: Follow the instructions in this article to post the information we need to help you.

  • I had compare the string without white space string is like ' 602-401165_Planning - Expedited Air' but it not find record from table By the way that record is available in my table

  • Try this:

    select * from GLCode_DATA where GLCode LIKE '602-434345%'

    What does that return?

    -SQLBill

  • You aren't doing anything to help us help you.

    Again, with more feeling:

    Lynn Pettis (6/19/2015)


    Okay, I must not have spoken clear enough. Please reread my earlier post with the two steps I said you should take to help us help you.

    I will even repeat them here:

    Step 1: Read this article: http://www.sqlservercentral.com/articles/Best+Practices/61537/

    Step 2: Follow the instructions in this article to post the information we need to help you.

  • I had try like if I enter new data like gl code CA700-40165_Home Dt Canada - Expedited Air' then its work but old data which already in table that cant search

  • meerack11 (6/19/2015)


    I had try like if I enter new data like gl code CA700-40165_Home Dt Canada - Expedited Air' then its work but old data which already in table that cant search

    i think there is a language problem, since you just keep saying the same thing, instead of answering or contributing. pseudo code like " I search for banana and find nothing" is not the same as showing explicit code like this:

    SELECT * FROM MyTable Where MyColumn = 'fruits or something'

    show us your exact query.

    show us sample data,like Luis was kind enough to create out of thin air.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • meerack11 (6/19/2015)


    I had try like if I enter new data like gl code CA700-40165_Home Dt Canada - Expedited Air' then its work but old data which already in table that cant search

    When are you going to help us help you, or do you prefer getting answers that don't help in any way?

    AGAIN:

    Lynn Pettis (6/19/2015)


    You aren't doing anything to help us help you.

    Again, with more feeling:

    Lynn Pettis (6/19/2015)


    Okay, I must not have spoken clear enough. Please reread my earlier post with the two steps I said you should take to help us help you.

    I will even repeat them here:

    Step 1: Read this article: http://www.sqlservercentral.com/articles/Best+Practices/61537/

    Step 2: Follow the instructions in this article to post the information we need to help you.

  • As has already been pointed out you are not providing enough information to get a useful response.

    Take a step back and re-evaluate what you need to do and then post your questions.

    I get it that you might be under some pressure but your problem still does not get solved either way if you don't provide the clarity needed to answer your question.

Viewing 12 posts - 16 through 26 (of 26 total)

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