dbTalk Databases Forums  

Data checking problem...

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Data checking problem... in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
John
 
Posts: n/a

Default Data checking problem... - 08-23-2004 , 07:56 AM






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



Reply With Quote
  #2  
Old   
Jacco Schalkwijk
 
Posts: n/a

Default Re: Data checking problem... - 08-23-2004 , 10:31 AM






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 (AT) kmznet (DOT) com> wrote

Quote:
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





Reply With Quote
  #3  
Old   
John
 
Posts: n/a

Default Re: Data checking problem... - 08-23-2004 , 01:22 PM



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 (AT) to (DOT) newsgroups.mvps.org.invalid> wrote
in message news:uHXVMZSiEHA.4020 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Quote:
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 (AT) kmznet (DOT) com> wrote in message
news:2ou7unFeq4q1U1 (AT) uni-berlin (DOT) 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







Reply With Quote
  #4  
Old   
Jacco Schalkwijk
 
Posts: n/a

Default Re: Data checking problem... - 08-24-2004 , 05:19 AM



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 (AT) kmznet (DOT) com> wrote

Quote:
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 (AT) to (DOT) newsgroups.mvps.org.invalid
wrote
in message news:uHXVMZSiEHA.4020 (AT) TK2MSFTNGP10 (DOT) 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 (AT) kmznet (DOT) com> wrote in message
news:2ou7unFeq4q1U1 (AT) uni-berlin (DOT) 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









Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.