Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 patindex help

Author  Topic 

jamie
Aged Yak Warrior

542 Posts

Posted - 2008-12-23 : 06:03:02
hi,
I am trying to use patindex to match 2 fields but doesn't seem to work.

select * from address
where patindex('%'+address1+'%','%'+address2+'%') > 0

what I am trying to do is match :

greater london with london inner area

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2008-12-23 : 06:12:29
'greater london' isn't anywhere in the string 'london inner area', thats why you aren't finding a match.
Go to Top of Page

jamie
Aged Yak Warrior

542 Posts

Posted - 2008-12-23 : 06:14:14
is there anyway of doing this sort of comparison ?
ie, a word in one field matches with a word in another field.
Go to Top of Page

jamie
Aged Yak Warrior

542 Posts

Posted - 2008-12-23 : 07:07:47
also another example would be tyne and wear needs to match to tyneside..
any help would be great, maybe patindex is the incorrect function to be using.
Go to Top of Page

jamie
Aged Yak Warrior

542 Posts

Posted - 2008-12-24 : 04:07:30
hi, does anyone know how to do this ?
Go to Top of Page
   

- Advertisement -