View Single Post
  #1 (permalink)  
Old February 6th, 2004, 04:17 PM
ank2go ank2go is offline
Authorized User
 
Join Date: Jun 2003
Location: Rochester, NY, USA.
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default Please Help - Tricky String Comparison

Hi All,

Thanks in advance for your replies.

I think this is a tricky comparison of string.

Let''s say I have the following tables and fields:

tbl01 tbl02
proid fullname proid fullname
------------- -------------
100 Parker, Peter S. 100 Parker, Peter S. M.
200 Jane, Mary T. 200 Jane, Mary K.
300 Wie, Michelle O. 300 Wie, Michel O.


'fullname' format is lastname, firstname initial.

I would like to return the record on
tbl01.proid=tbl02.proid
and tbl01.(lastname)=tbl02.(lastname)
and tbl01.(firstname)=tbl02.(firstname)

The above example would return 100 and 200.
300 would be excluded b/c 'Michele' <> 'Michel'.

If I had to do this in ASP or C#, then it''s easy.
I could easily split 'fullname' to get first and last name.
But I need to script this in T-SQL.
My box is MS SQL 7.0.

Please help if you know how to do this.
Appreciate all that post !

Thanks You.
Reply With Quote