Re: can't compare a varchar properly using WHERE
From: Armando (
Date: 03/02/04
- Next message: Robert: "Re: What is a "cube""
- Previous message: milmus: "RE: table join with itself"
- In reply to: darrel: "Re: can't compare a varchar properly using WHERE"
- Next in thread: darrel: "Re: can't compare a varchar properly using WHERE"
- Reply: darrel: "Re: can't compare a varchar properly using WHERE"
- Messages sorted by: [ date ] [ thread ]
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
>
>
- Next message: Robert: "Re: What is a "cube""
- Previous message: milmus: "RE: table join with itself"
- In reply to: darrel: "Re: can't compare a varchar properly using WHERE"
- Next in thread: darrel: "Re: can't compare a varchar properly using WHERE"
- Reply: darrel: "Re: can't compare a varchar properly using WHERE"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|