Re: Need help with Simple script
- From: Hugo Kornelis <hugo@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 30 Jan 2006 23:47:22 +0100
On Mon, 30 Jan 2006 09:00:37 -0800, bluesrock12000 wrote:
>Example data:
>
>column1 column2
>abcs12 123456
>asdf-af 1234
>asrlkk' 123456789
>
>What I need to do is capture the data that does not have exactly 6 numeric
>numbers in column2. So the desired result would display rows 2 & 3.
>
>Any help would be appreciated,
>
>Thanks in advance.
Hi Dwayne,
If column2 is defined as a character datatype:
SELECT column1, column2
FROM YourTable
WHERE column2 NOT LIKE '[0-9][0-9][0-9][0-9][0-9][0-9]'
Or, if column2 is defined as an integer:
SELECT column1, column2
FROM YourTable
WHERE column2 < 100000
OR column2 > 999999
--
Hugo Kornelis, SQL Server MVP
.
- Prev by Date: Re: Compare row data and input data into a new field
- Previous by thread: RE: Compare row data and input data into a new field
- Index(es):
Relevant Pages
|
|