Re: can't compare a varchar properly using WHERE

From: Armando ()
Date: 03/02/04


Date: Tue, 2 Mar 2004 15:36:28 -0500

LIKE is for finding strings that share a common pattern of characters

For instance, say you want to find all rows where the person's last name
starts with 'Martin' and you have the following employees

Gilmartin
Martin
Martinez

You would issue a command like

SELECT *
FROM employees
WHERE LASTNAME LIKE 'Martin%'

This would bring back names like

Martin & Martinez but would not return Gilmartin.

The % sign is used a wildcarding character and can be used at the
beginning or end of the string.

BOL is a good source for additional info... search for LIKE

"darrel" <notreal@hotmail.com> wrote in message
news:%23mol0QJAEHA.2660@TK2MSFTNGP10.phx.gbl...
> > Is the WHERE clause accurate? I don't see single quotes
> > around the string News. Is there a column named News
> > defined in the table?
>
> Argh!
>
> I was missing single quotes. Ugh.
>
> Before I was just basing the where on integers, which, I guess, don't need
> single quotes.
>
> Thanks!
>
> > WHERE Application LIKE 'News%'
>
> Out of curiosity, what would one use the LIKE statement for? I'm new to
SQL
> and haven't seen the 'like' yet.
>
> -Darrel
>
>



Relevant Pages

  • Re: Mandis Quotes (aka retiring """ and )
    ... > surround the string by a pair of doubled single quotes. ... > an arbitrary string in-between the single quotes which does NOT ... > of ASCII or Unicode characters, but instead as a sequence of lines ...
    (comp.lang.python)
  • Re: Mandis Quotes (aka retiring """ and )
    ... >surround the string by a pair of doubled single quotes. ... > of ASCII or Unicode characters, but instead as a sequence of lines ... Quoting "arbitrary" text also involves the issue of encoding, ...
    (comp.lang.python)
  • Mandis Quotes (aka retiring """ and )
    ... arbitrary textual matter called "Mandis quotes". ... surround the string by a pair of doubled single quotes. ... of ASCII or Unicode characters, but instead as a sequence of lines ...
    (comp.lang.python)
  • Re: Getting Rid of the Nulls
    ... string newString = oldString.Trim(note the single quotes, ... > to converter a byte array from the registry to a string. ... but I end up with a bunch of null characters after ... > The only thing I can think of is to convert the string to a char array ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Prothon should not borrow Python strings!
    ... """It does not make sense to have a string without knowing what encoding ... same cul de sac as Python. ... Prothon_String_As_ASCII // raises error if there are high characters ... Python's split between byte strings and Unicode strings is ...
    (comp.lang.python)