Re: Need help with Simple script



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
.



Relevant Pages

  • Datalist of datagrid
    ... I want to create datagrid or datalist that has 4 columns: ... column2 - answer(that column would have colspan =1 or more depending ... Schapopa ... Prev by Date: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Append Query Using MAX()
    ... Jumping Matt Flash wrote: ... INSERT INTO tblTable (column1, column2) ... SELECT 'string1' AS column1, ... Prev by Date: ...
    (microsoft.public.access.queries)