tsql - Not Producing correct output when used like operator - sql server 2008 -
my sql server case sensitive: latin1_general_ci_as
i have 2 table given below.
declare @tablea table ( custname varchar (100) )  insert @tablea  select 'one stop motorist centre'   declare @tableb table ( custname varchar (100) )  insert @tableb  select 'one stop motorist centre & bodyshop' union select 'one stop motorist centre (cambridge' union select 'one stop motorist centre (cambridge' union select 'one stop motorist centre & bodyshop'   but not getting when running below query, not giving result.
select * @tablea inner join @tableb b on  '%'+ upper(a.[custname])+'%' '%'+ upper(b.[custname])+'%'   can suggest tweek have result.
the pattern goes on right side of like.  example:
select * @tablea inner join      @tableb b      on upper(b.[custname]) '%'+ upper(a.[custname])+'%';   if want inclusion in either direction, use 2 conditions:
select * @tablea inner join      @tableb b      on upper(b.[custname]) '%'+ upper(a.[custname])+'%' or         upper(a.[custname]) '%'+ upper(b.[custname])+'%';   i should note default, sql server case-insensitive. don't need upper-case values in cases.
Comments
Post a Comment