MSSQL LIKE and IN statements in ADO problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve Holden

    #16
    Re: MSSQL LIKE and IN statements in ADO problem

    Raja Raman Sundararajan wrote:
    [...][color=blue]
    > Any inputs to improve the IN statement logic?
    > My dream is to use just one create parameter for the SQL list
    > so that the query looks like
    > query = "SELECT * FROM tb_name WHERE firstname IN ?"
    > Nice and easy...
    >[/color]
    Some DBAPI modules will indeed allow you to use a list or set parameter
    for this purpose, but not all.

    regards
    Steve
    --
    Steve Holden +44 150 684 7255 +1 800 494 3119
    Holden Web LLC www.holdenweb.com
    PyCon TX 2006 www.python.org/pycon/

    Comment

    • gregarican

      #17
      Re: MSSQL LIKE and IN statements in ADO problem

      Raja Raman wrote:
      [color=blue]
      > Hi Gregarican,
      > Thanks for sharing your code. One needs to add the % signs if one
      > wants to do wildcard searches using LIKE in the SQL server.
      > Do as Roger and Steve suggested '%raj%', now you can find the names
      > containing the word raj anywhere in the column.
      > just value = 'raj' is only going to fetch you fnames that == 'raj'
      > Originally my problem was using the LIKE statement itself. But I guess
      > you already know.[/color]




      Duhhh on my part. A little behind the curve as I'm recouping from adult
      chicken pox. Coding from the sickbed isn't ideal I suppose :-)

      Comment

      Working...