Correct Syntax for "Contains" or "like" - InfoPath Dev
in

InfoPath Dev

Correct Syntax for "Contains" or "like"

Last post 01-02-2013 07:40 AM by douglasjenn. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 12-31-2012 06:23 AM

    Correct Syntax for "Contains" or "like"

    I need to pull in results from a SQL table into an Infopath.  I would like for it to only return values that "contain" a value.  (For example, only pull where OED_Relationship contains employee last name) .  What is the correct syntax when using the concat statement to return "like" results?

    Here's my current code which is definitely not working. 

    concat("ModifySqlQuery /dsname=DailyEDWforOEDCustomers /where=where v_dv_RPCode_052.OED_Relationship like '%''", LastName, "%", "'")

  • 12-31-2012 07:54 AM In reply to

    Re: Correct Syntax for "Contains" or "like"

    Well, the syntax is where ColumnName like '%value%', so, in general, this looks correct. Can you open SQL Management Studio and try to execute your query with a where clause and the value you are trying for last name and see what your results are?

    Hilary Stoupa

  • 12-31-2012 11:46 AM In reply to

    Re: Correct Syntax for "Contains" or "like"

    Is there a reason for the pair of apostrophes after the first %?  Those could be preventing any results from coming back.

    And please make sure you are validating LastName (i.e. ensuring that it does not contain any apostrophes) before using it in an SQL query.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-31-2012 11:48 AM In reply to

    Re: Correct Syntax for "Contains" or "like"

    Oh - good catch, I didn't even see those!
    Hilary Stoupa

  • 01-02-2013 07:40 AM In reply to

    Re: Correct Syntax for "Contains" or "like"

    Working like a charm now.  Thanks so much!
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.