October 12, 2007 at 4:54 pm
I've drawn a blank. I want to compare fielda and fieldb and find cases where the value of fieldb is part of the value in fielda.
October 12, 2007 at 5:18 pm
you mean like a substring?
declare @sample table(col1 varchar(10),Col2 varchar(30) )
insert into @sample
select '.com' ,'www.whatever.com' union
select '.net','www.whatever.com' union
select '.net','www.whatever.net'
--charindex [string to find], [column or value to find to test]
select * from @sample where charindex(col1,col2) > 0
resutls:
col1 Col2
---------- ------------------------------
Lowell
October 12, 2007 at 5:29 pm
Kind of a DUH! moment for me. Thanks. This is exaclty what I needed.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply