'Like' statement with a variable

Discussion in 'ASP .Net' started by =?Utf-8?B?YWJuZXdhbGxv?=, Mar 16, 2007.

  1. I am in the Query Builder component of Visual Web Developer Express Edition
    and wish to use a variable in the 'Like' part of an SQL statement
     
    =?Utf-8?B?YWJuZXdhbGxv?=, Mar 16, 2007
    #1
    1. Advertising

  2. abnewallo wrote:
    > I am in the Query Builder component of Visual Web Developer Express Edition
    > and wish to use a variable in the 'Like' part of an SQL statement


    Yes, and the problem is?

    --
    Göran Andersson
    _____
    http://www.guffa.com
     
    =?UTF-8?B?R8O2cmFuIEFuZGVyc3Nvbg==?=, Mar 16, 2007
    #2
    1. Advertising

  3. Could someone help me with the syntax of the 'Like' portion of the statement?

    For example I am using the following

    Where Title Like @titl & '%'

    and I am getting an error message the following error message

    The data types nvarchar and varchar are incompatible in the booleand AND
    operator.

    I have also tried several combinations of the double quotes as well but so
    far have been unsuccessful

    "Göran Andersson" wrote:

    > abnewallo wrote:
    > > I am in the Query Builder component of Visual Web Developer Express Edition
    > > and wish to use a variable in the 'Like' part of an SQL statement

    >
    > Yes, and the problem is?
    >
    > --
    > Göran Andersson
    > _____
    > http://www.guffa.com
    >
     
    =?Utf-8?B?YWJuZXdhbGxv?=, Mar 16, 2007
    #3
  4. On Mar 16, 1:58 pm, abnewallo <>
    wrote:
    > Could someone help me with the syntax of the 'Like' portion of the statement?
    >
    > For example I am using the following
    >
    > Where Title Like @titl & '%'
    >
    > and I am getting an error message the following error message
    >
    > The data types nvarchar and varchar are incompatible in the booleand AND
    > operator.
    >
    > I have also tried several combinations of the double quotes as well but so
    > far have been unsuccessful
    >
    >
    >
    > "Göran Andersson" wrote:
    > > abnewallo wrote:
    > > > I am in the Query Builder component of Visual Web Developer Express Edition
    > > > and wish to use a variable in the 'Like' part of an SQL statement

    >
    > > Yes, and the problem is?

    >
    > > --
    > > Göran Andersson
    > > _____
    > >http://www.guffa.com- Hide quoted text -

    >
    > - Show quoted text -


    try

    Where Title Like @titl + '%'
     
    Alexey Smirnov, Mar 16, 2007
    #4
  5. Thanks. It worked.

    "Alexey Smirnov" wrote:

    > On Mar 16, 1:58 pm, abnewallo <>
    > wrote:
    > > Could someone help me with the syntax of the 'Like' portion of the statement?
    > >
    > > For example I am using the following
    > >
    > > Where Title Like @titl & '%'
    > >
    > > and I am getting an error message the following error message
    > >
    > > The data types nvarchar and varchar are incompatible in the booleand AND
    > > operator.
    > >
    > > I have also tried several combinations of the double quotes as well but so
    > > far have been unsuccessful
    > >
    > >
    > >
    > > "Göran Andersson" wrote:
    > > > abnewallo wrote:
    > > > > I am in the Query Builder component of Visual Web Developer Express Edition
    > > > > and wish to use a variable in the 'Like' part of an SQL statement

    > >
    > > > Yes, and the problem is?

    > >
    > > > --
    > > > Göran Andersson
    > > > _____
    > > >http://www.guffa.com- Hide quoted text -

    > >
    > > - Show quoted text -

    >
    > try
    >
    > Where Title Like @titl + '%'
    >
    >
     
    =?Utf-8?B?YWJuZXdhbGxv?=, Mar 16, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    837
  2. Jay McGavren
    Replies:
    11
    Views:
    1,186
    Alan Krueger
    Jan 16, 2006
  3. Patrick Kowalzick
    Replies:
    5
    Views:
    511
    Patrick Kowalzick
    Mar 14, 2006
  4. Froefel
    Replies:
    1
    Views:
    803
    Mark Rae [MVP]
    Jul 4, 2007
  5. Mike Mr.
    Replies:
    4
    Views:
    222
    Mike Jo
    Sep 21, 2008
Loading...

Share This Page