LIKE Clause

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Craig Smesny

    #1

    LIKE Clause


    SELECT Jobno, Revision, Rotation, RType, CustomerPattern ,
    CustomerColor, MillPattern, MillColor
    FROM Rotations
    WHERE (MillColor LIKE @Color) AND (MillPattern LIKE @Pattern)

    When using this query in a dataset the like clauses will not work
    together. Used one at a time they are fine,but together the second
    parameter will not work with wildcard characters. Any help would be
    appreciated.


    *** Sent via Developersdex http://www.developersdex.com ***
  • Ignacio Machin ( .NET/ C# MVP )

    #2
    Re: LIKE Clause

    On Aug 19, 10:00 am, Craig Smesny <csme...@vipsam ples.comwrote:
    SELECT     Jobno, Revision, Rotation, RType, CustomerPattern ,
    CustomerColor, MillPattern, MillColor
    FROM         Rotations
    WHERE     (MillColor LIKE @Color) AND (MillPattern LIKE @Pattern)
    >
    When using this query in a dataset the like clauses will not work
    together. Used one at a time they are fine,but together the second
    parameter will not work with wildcard characters. Any help would be
    appreciated.
    >
    *** Sent via Developersdexht tp://www.developersd ex.com***
    hi,

    is this a SQL question?
    What you mean with a "queri in a dataset" ?

    Comment

    • DaveL

      #3
      Re: LIKE Clause

      string sSql =
      "SELECT Jobno, Revision, Rotation, RType, CustomerPattern "+
      ",CustomerColor , MillPattern, MillColor "+
      " FROM Rotations With (Nolock) "+
      " WHERE MillColor LIKE '%@Color%' AND MillPattern LIKE '%@Pattern%'")

      somthing like the above should work for u....play with it

      "Craig Smesny" <csmesny@vipsam ples.comwrote in message
      news:OrWnzPgAJH A.4992@TK2MSFTN GP06.phx.gbl...
      >
      SELECT Jobno, Revision, Rotation, RType, CustomerPattern ,
      CustomerColor, MillPattern, MillColor
      FROM Rotations
      WHERE (MillColor LIKE @Color) AND (MillPattern LIKE @Pattern)
      >
      When using this query in a dataset the like clauses will not work
      together. Used one at a time they are fine,but together the second
      parameter will not work with wildcard characters. Any help would be
      appreciated.
      >
      >
      *** Sent via Developersdex http://www.developersdex.com ***

      Comment

      • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

        #4
        Re: LIKE Clause

        Craig Smesny wrote:
        SELECT Jobno, Revision, Rotation, RType, CustomerPattern ,
        CustomerColor, MillPattern, MillColor
        FROM Rotations
        WHERE (MillColor LIKE @Color) AND (MillPattern LIKE @Pattern)
        >
        When using this query in a dataset the like clauses will not work
        together. Used one at a time they are fine,but together the second
        parameter will not work with wildcard characters. Any help would be
        appreciated.
        I think we will need to see the relevant code especially where
        the parameters get set.

        Arne

        Comment

        • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

          #5
          Re: LIKE Clause

          DaveL wrote:
          string sSql =
          "SELECT Jobno, Revision, Rotation, RType, CustomerPattern "+
          ",CustomerColor , MillPattern, MillColor "+
          " FROM Rotations With (Nolock) "+
          " WHERE MillColor LIKE '%@Color%' AND MillPattern LIKE '%@Pattern%'")
          >
          somthing like the above should work for u....
          It will not work.

          Parameters are complete values.

          " WHERE MillColor LIKE ('%' + @Color + '%') AND MillPattern LIKE
          ('%' + @Pattern + '%')")

          Arne

          Comment

          Working...