|
 |
asp_databases thread: Pattern Matching in a SQL database field
Message #1 by "Peter Foti (PeterF)" <PeterF@S...> on Tue, 21 May 2002 10:27:09 -0400
|
|
If a table has a text field (insnum) that stores values like this:
02-01
02-23
02-44
03-04
03-19
And I want to get all of the records that begin with 02, what would my
WHERE clause look like? Is this correct, or does this only work for
Access?
WHERE insnum LIKE '02*'
Is that correct, or does LIKE only work with Access?
Thanks,
Pete
Message #2 by "Sandra" <salau@p...> on Tue, 21 May 2002 23:25:25
|
|
Hi Pete,
-----------------------------------------------------------------------
And I want to get all of the records that begin with 02, what would my
WHERE clause look like? Is this correct, or does this only work for
Access?
WHERE insnum LIKE '02*'
-----------------------------------------------------------------------
That's partially correct.
The LIKE wildcard is not an asterix: it's a percent sign.
So to have it completely correct, you would write
WHERE insnum LIKE '02%'
HTH,
Sandra
Message #3 by "Drew, Ron" <RDrew@B...> on Wed, 22 May 2002 08:10:24 -0400
|
|
I use
WHERE insnum LIKE '02%'
But it may depend on the DB
-----Original Message-----
From: Sandra [mailto:salau@p...]
Sent: Tuesday, May 21, 2002 7:25 PM
To: ASP Databases
Subject: [asp_databases] Re: Pattern Matching in a SQL database field
Hi Pete,
-----------------------------------------------------------------------
And I want to get all of the records that begin with 02, what would my
WHERE clause look like? Is this correct, or does this only work for
Access?
WHERE insnum LIKE '02*'
-----------------------------------------------------------------------
That's partially correct.
The LIKE wildcard is not an asterix: it's a percent sign.
So to have it completely correct, you would write
WHERE insnum LIKE '02%'
HTH,
Sandra
|
|
 |