Re: Data checking problem...

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Jacco Schalkwijk (jacco.please.reply_at_to.newsgroups.mvps.org.invalid)
Date: 08/24/04


Date: Tue, 24 Aug 2004 11:19:16 +0100

1. shows you all the rows that where the lastname column doesn't contains
_any_ of the a-z characters. In your case this is only satisfied by empty
strings, but it could also be satisfied by '1', '£%^&' or something similar.
(but not by '&*^a')

2. I made a typo in my post. LIKE '%^[a-z]%' doesn't make sense it this
case, because that looks for any string that includes something like '^a'.

That leaves us with:
3. Your 5 rows might include spaces (at the end)? Also, what is included
between a and z depends on the collation you have. In most collations
accented characters are ordered directly after or with the normal
characters.

-- 
Jacco Schalkwijk
SQL Server MVP
"John" <jtaylor@kmznet.com> wrote in message 
news:2our2pFe7d9tU1@uni-berlin.de...
> Hey Jacco,
> Why is this not working for me? I'd appreciate anyone's assistance, I've
> been
> attacking this with no signs of success.
> I try:
> 1.  SELECT * FROM tablename where lastname NOT LIKE '%[a-z]%'
> and it shows me two records where the lastname is blank.
> 2.  SELECT * FROM tablename where lastname LIKE '%^[a-z]%'
> and it shows me no records.
> 3.  SELECT * FROM tablename where lastname LIKE '%[^a-z]%'
> and it shows me all but 5 records (and those 5 records are just normal
> names, no
> strange characters or whathaveyou).
>
> What am I doing wrong?
> Thanks.
>
>
> "Jacco Schalkwijk" <jacco.please.reply@to.newsgroups.mvps.org.invalid> 
> wrote
> in message news:uHXVMZSiEHA.4020@TK2MSFTNGP10.phx.gbl...
>> Something like:
>>
>> IF firstname LIKE '%^[a-z]%' OR lastname LIKE '%[^a-z]%'
>>
>> ^ works as a logical not on the character or set of characters that
> follows.
>>
>> -- 
>> Jacco Schalkwijk
>> SQL Server MVP
>>
>>
>> "John" <jtaylor@kmznet.com> wrote in message
>> news:2ou7unFeq4q1U1@uni-berlin.de...
>> >A relative dts/sql newbie and just seeing if anyone has
>> > any ideas...
>> >
>> > Basically I need a task in my DTS package to check if
>> > there are any non-alphabetic (anything that's not a-z)
>> > characters in the first name and last name fields of a table,
>> > then bust off an email if there is.
>> >
>> > I'm not too keen on creating a plethora of sql tasks to
>> > search for every single non-alphabetic character, so does
>> > anyone have any ideas how to condense my code?
>> >
>> > Thanks,
>> > John
>> >
>> >
>>
>>
>
> 


Relevant Pages

  • Re: Max lenght of column_alias, table_alias
    ... Aliases must follow the same rules as object names, ... can be a maximum of 128 characters. ... Jacco Schalkwijk ... SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: Inserting line breaks ( ) in SQL DB
    ... characters aren't needed when copy data between program variables. ... >> string with '@' so that backslashes within the string are not interpreted ... >> as escape characters. ... >> SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: query
    ... Most good judgment comes from experience. ... WHEN ColumnNameHere LIKE '%%' THEN '00' ... characters have to be numeric", but they do allow a test for "no ... Hugo Kornelis, SQL Server MVP ...
    (microsoft.public.sqlserver.mseq)
  • Re: Job SQL Limitation
    ... >>If you are> 3200 characters, ... or use CmdExec jobstep which calls ... >>Tibor Karaszi, SQL Server MVP ...
    (microsoft.public.sqlserver.server)
  • Re: Substring breaking words.
    ... implement in TSQL... ... SQL Server MVP ... -- "Lee" wrote in message ... For example if the 145- 153 characters> were the word 'Microsoft' it could not leave 'Micros' at the end of the first> line and start the second with ''oft'. ...
    (microsoft.public.sqlserver.programming)